Skip to content

[Refactor] Notes#11971

Draft
SchrodingersGat wants to merge 119 commits into
inventree:masterfrom
SchrodingersGat:block-notes
Draft

[Refactor] Notes#11971
SchrodingersGat wants to merge 119 commits into
inventree:masterfrom
SchrodingersGat:block-notes

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented May 20, 2026

Copy link
Copy Markdown
Member

Example Screenshots

Description Screenshot
Display Mode image
Edit Mode image
Rendered to report image

Generic Notes Table

The major item here is to move all notes into a new table, which has generic FK links to other items. This brings it into line with how we handle attachments, parameters, etc.

Multiple Notes

We can now specify multiple, separate notes per item. This is useful for keeping different types of notes separate - e.g. shipping instructions vs inspection instructions (for e.g.)

Render to report

Rendering notes to reports is now greatly improved. In particular, images are correctly handled now - and can even be resized based on the specified size in the HTML content

Editor Updates

Also introduces the possibility of a more intuitive notes editor.

At this stage, I am trialing BlockNote - which provides navite mantine support, and provides a "notion style" editing interface.

I am using the Rich Text Editor shipped as part of the Mantine framework.

Pros:

  • Intuitive, "modern" editing interface
  • Supports more content layout features
  • Resizable images

Cons:

  • Requires HTML formatting
  • Current notes use markdown

Tasks

  • Display note information (title / description / last updated by)
  • Allow edit notes (if user has permission)
  • Allow delete notes (if user has permission)
  • Client side sanitize of notes
  • Server side sanitize of notes
  • Support direct image upload (drag and drop / copy-paste)
  • Render notes in PDF reports
  • Ensure inline images are rendered correctly in PDF reports
  • Documentation
  • Data migration for existing notes
  • Data migration for existing notes image
  • Handle legacy "NotesImage" concept - how to detect and embed these images?
  • prevent navigation away when notes are dirty
  • Allow note selection from query params
  • Update demo dataset with notes / images / etc (BEFORE migration)
  • Apply data migration to demo dataset
  • Unit tests (backend)
  • Duplicate notes from existing instance - also copies embedded images
  • Playwright tests
  • Unit tests for data migrations
  • Remove "notes" field from any models which use the new approach
  • Delete the old "notes" mixin class
  • Support dark mode
  • Support localization
  • Remove old dependencies for simplemde
  • Delete old "delete_old_notes_images" task
  • Mark "delete_old_notes_images" task as outdated
  • Update app support (display multiple notes)
  • Add CHANGELOG entry

Ideas for future work

  • Add plugin to link directly to attachments
  • Add plugin to link to other pages (e.g. parts / orders / etc)
  • Export notes?

@SchrodingersGat SchrodingersGat added this to the 1.4.0 milestone May 20, 2026
@SchrodingersGat SchrodingersGat added api Relates to the API refactor feature migration Data or schema migrations User Interface Related to the frontend / User Interface full-run Always do a full QC CI run labels May 20, 2026
@netlify

netlify Bot commented May 20, 2026

Copy link
Copy Markdown

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 9a38642
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a2d57508ac4a60008b195ca
😎 Deploy Preview https://deploy-preview-11971--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 92 (🔴 down 1 from production)
Accessibility: 82 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@SchrodingersGat SchrodingersGat marked this pull request as draft May 20, 2026 12:41
@SchrodingersGat

Copy link
Copy Markdown
Member Author

@matmair @wolflu05 before I go too far with this I'd be interested in your feedback around two major points:

Data Structure Refactor: Are we on board with the idea of supporting multiple notes per item?

Editor: Do you have any objections to moving to a new editor, and move to HTML notes? We will obviously have to tackle any data sanitizing required here

@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.42077% with 102 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.89%. Comparing base (457fe16) to head (9a38642).

❌ Your patch check has failed because the patch coverage (86.72%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (84.89%) is below the target coverage (85.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11971      +/-   ##
==========================================
- Coverage   86.50%   84.89%   -1.62%     
==========================================
  Files        1386     1389       +3     
  Lines       89328    88796     -532     
  Branches    10185     9837     -348     
==========================================
- Hits        77273    75383    -1890     
- Misses      11991    13354    +1363     
+ Partials       64       59       -5     
Flag Coverage Δ
backend 90.02% <81.42%> (-0.50%) ⬇️
migrations 40.24% <37.52%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 91.44% <82.54%> (-0.62%) ⬇️
Backend General 93.07% <86.72%> (-0.45%) ⬇️
Frontend 75.86% <ø> (-3.58%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matmair

matmair commented May 20, 2026

Copy link
Copy Markdown
Member

I think the general idea is very good; a few points/ideas:

  • I would like to see some tests in the final PR to ensure we do not leak data due to this migration
  • if we already build a new model we might as well add created, updated and created_by, updated_by fields
  • does a note owner make sense?
  • should we add user customizable types?
  • should we addnote states?
  • having a special "primary" note that still renders to the api seems like a good idea; i have seen a bunch of ppl use notes fields for all kind of plugins; this change would be pretty breaking

I like blocknote as a choice, the OpenProject and a bunch of other EU sovereign gov cloud products use it.
How we save/provide notes data in the future is still a bit of a question; there is markdown support from what I can tell. And if we are already switching data model why not use the native document format and just save a html (or markdown) representation on the side? That seems safer and better for future customizations of the editor capabilities.

Things i am unsure about:

  • what does rendering to reports look like? are existing reports breaking?
  • possible security problems?

@wolflu05

Copy link
Copy Markdown
Member

I also like the general idea, the current notes editor seems very limited. But I would appreciate if there would be some easy migration path from markdown based notes to the new format, and a method to render the new notes format to reports.

@matmair

matmair commented Jun 3, 2026

Copy link
Copy Markdown
Member

Can we remove django-markdownify with this? would remove a few dependencies. I have made a small demo branch for this: matmair#676

@SchrodingersGat SchrodingersGat modified the milestones: 2.0.0, 1.5.0 Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API breaking Indicates a major update or change which breaks compatibility feature full-run Always do a full QC CI run migration Data or schema migrations refactor User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notes Improvements

3 participants