flutter_blocknote_editor 0.0.19
flutter_blocknote_editor: ^0.0.19 copied to clipboard
A Flutter package (beta) that embeds BlockNoteJS inside a WebView with bidirectional communication, transaction batching, and undo/redo safety.
0.0.19 #
- Keyboard and WebView (Scaffold):
- README: new section "Keyboard and WebView (Scaffold)" documenting
resizeToAvoidBottomInset: falseso the WebView handles keyboard padding and avoids scroll jump or ~40–60px gap when typing - Example app: Scaffold uses
resizeToAvoidBottomInset: false; editor usesextraBottomPaddingfor demo
- README: new section "Keyboard and WebView (Scaffold)" documenting
- Theme and background sync:
- New
syncEditorAppearanceToPage()in webViewHeightManager: syncs editor appearance (light/dark and background) from.bn-container(data-color-scheme,--bn-colors-editor-background) to html, body, and #root so the bottom padding area (keyboard/extraBottomPadding) matches the editor useThemeBackgroundrefactored to usesyncEditorAppearanceToPage()and to observe.bn-containerfor theme/appearance changes via MutationObserver; page background now follows editor theme- Padding update in webViewHeightManager calls
syncEditorAppearanceToPage()instead of inline background logic; removed debug console logging - Default white background for html, body, #root in index.css and index.html so padding area matches before theme applies
- New
- Selection visibility and keyboard:
- When the keyboard is likely open (visual viewport height reduced), the visible area uses the visual viewport bottom so content under the keyboard is not considered visible; fixes scroll-up-when-typing
- New helper
getEffectiveVisibleBottom(rootRect)in selectionVisibility
- Checklist focus:
- New
setupChecklistBlurOnToggle(tiptapEditor): blurs the editor after the user toggles a checklist checkbox so the editor does not retain focus useEditorReadywires up checklist blur on toggle after focus listeners
- New
- WebView height manager: clarified that total bottom padding is always keyboard height + extraBottomPadding (additive); added
_clearDelayedRechecks()for cleanup - Updated embedded web editor bundle (
assets/web/editor.js,assets/web/editor.css)
0.0.18 #
- Environment constraints:
- SDK:
^3.10.7→^3.8.0(support Dart 3.8.x and up) - Flutter:
>=1.17.0→>=3.32.0(align with current Flutter stable)
- SDK:
- Slash command handler: removed deprecated
onItemClickrequirement:BlockNoteSlashCommandItemaccepts optional [onItemClick] (inline JS) and optional [onItemClickScriptPath] (asset path to a JS file); at least one must be provided (assert)- When both are set, file takes priority when resolving; if the file cannot be loaded, inline is used
toJsonResolved(): loads script path first, falls back to inline on load failure
0.0.17 #
- Slash command icons: flexible support for custom icons (like custom block types):
- New sealed type
BlockNoteSlashCommandIconwith variants:BlockNoteSlashCommandIconText(emoji/short text),BlockNoteSlashCommandIconSvg(raw SVG string),BlockNoteSlashCommandIconImage(URL or data URL) BlockNoteSlashCommandIconImage.fromAsset(String assetPath)for loading PNG/JPEG from app assets (async)BlockNoteSlashCommandItem.iconnow acceptsString(backward compatible) orBlockNoteSlashCommandIcon- Web: slash menu renders text, SVG (with wrapper + CSS), and image icons; SVG inherits text color for
currentColor
- New sealed type
- Slash command handlers from JS file (like custom block type scripts):
- Added
onItemClickScriptPathtoBlockNoteSlashCommandItem: asset path to a JavaScript file whose content is used as the click handler (evaluated witheditorin scope) BlockNoteSlashCommandConfig.toJsonResolved(): async method that loads script paths and returns JSON with resolvedonItemClickfor the web view- DocumentLoader and BlockNoteEditor use
toJsonResolved()when applying slash command config so the web only receives resolved handler code
- Added
- Deprecated inline
onItemClickstring onBlockNoteSlashCommandItemin favor ofonItemClickScriptPathfor handler code (parameter and field are@Deprecated) - Example app: custom slash commands demo all icon variants (emoji, text, SVG, image data URL, image fromAsset) and "Insert current date" handler from
assets/slash_insert_date.js - Updated embedded web editor bundle (
assets/web/editor.js,assets/web/editor.css)
0.0.16 #
- Block diff: emit only the blocks that actually changed (no redundant parent update):
- Update detection now uses shallow-children comparison: a block is considered changed only if its own content/props or its child-id list changed; descendant content changes do not mark the parent as changed
- Editing a nested block (e.g. toggle list item) now produces a single update operation for that child block, not an additional update for the parent with full children
- New internal helper
blocksEqualShallowChildren;computeBlockDifferencesno longer takes ablocksEqualFnparameter
- Web editor: test added for "only one update for edited child block, not for parent" (shallow-children comparison)
0.0.15 #
- Transaction and block diff improvements:
- Transaction operations now include an optional
index(0-based) indicating operation order within the transaction; DartBlockNoteTransactionOphas optionalindexfield (fromJson/toJson/copyWith) - Block diff runs over the full block tree (all levels), not just top-level: nested blocks (e.g. toggle list children) get their own insert/update/delete operations with correct
beforeChildId/afterChildId/parentIdfrom the editor, so the transaction log shows the actual changed block and its siblings - Delete operations use tree-based context (
getBlockContextFromTree) for blocks at any level and includeparentId - New helpers:
getBlockContextFromTree,collectBlocksDepthFirst; exportedgetBlockContextFromEditor,getAdjacentBlockIdsFromTopLevelfor tests
- Transaction operations now include an optional
- Web editor: Vitest test suite for block diff and transaction sender (getBlockContextFromEditor, getAdjacentBlockIdsFromTopLevel, computeBlockDifferences, createInitialOperations, filterRedundantOperations, payload index, structure test for ID_1/ID_2/ID_3 and nested ID_1_2)
- Web editor: JSDoc updates for sibling/tree semantics; Prettier/ESLint fixes
0.0.14 #
- Document and transaction model updates:
- Added
generateBlockId()in Dart (UUID v4) and used inBlockNoteDocument.empty() - Transaction operations now include
afterChildId,beforeChildId, andorderedChildIdsfor block ordering and reorder support
- Added
- Web editor: block ID and transaction improvements:
- New
idGenerator.jsfor UUID v4 block IDs (crypto.randomUUID with RFC 4122 fallback) - Document loader and cleaner use centralized ID generation for blocks missing IDs
- Block diff and transaction sender support sibling links and reorder operations; initial operations include
beforeChildId/afterChildId/parentId - Editor initial content and transaction ops use generated block IDs consistently
- New
- Updated embedded web editor bundle (
assets/web/editor.js)
0.0.13 #
- Improved custom slash menu support:
- Added
buildSlashMenuItemsutility for building custom slash menus from Flutter configuration - Enhanced slash menu integration with memoization to prevent unnecessary rebuilds
- Better support for filtering default slash menu items via
availableSlashCommandswhitelist - Improved custom slash command execution with error handling
- Added
- Enhanced touch gesture handling:
- Disabled pinch zoom and double-tap zoom gestures to prevent accidental zooming
- Improved touch event handling for toolbar buttons and interactive elements
- Better viewport meta tag management for consistent mobile behavior
- Updated embedded web editor bundle (
assets/web/editor.js)
0.0.12 #
- Added link tap handling:
- New
onLinkTappedcallback inBlockNoteEditorto handle link clicks - Link clicks are intercepted in the editor and sent to Flutter via message channel
- Prevents default navigation, allowing custom handling (e.g., using
url_launcher) - Added
useLinkTapHandlerhook in web editor for link click interception - Added
LinkTapMessagemessage type for link tap communication
- New
- Updated embedded web editor bundle (
assets/web/editor.js)
0.0.11 #
- Improved WebView height management and scrolling behavior:
- Enhanced selection visibility detection for better keyboard interaction
- Improved scroll-to-selection handling with debouncing for content size changes
- Better handling of keyboard open/close states with visual viewport detection
- Refactored scroll helpers and selection visibility utilities for better code organization
- Enhanced content size change handling:
- Added debouncing for scroll-to-selection to avoid excessive scrolling
- Improved detection of significant content size changes (>20px threshold)
- Better handling of minor content adjustments without resetting debounce timers
- Updated embedded web editor bundle (
assets/web/editor.js)
0.0.10 #
- Added
BlockNoteControllerfor programmatic editor operations:getDocument()- Retrieve full document on-demand without large data transfers on every changeloadDocument()- Load documents programmaticallyflush()- Flush pending transactions immediately- Methods to set editor configuration (read-only, toolbar, slash commands, schema, etc.)
- Accessible via
onReadycallback inBlockNoteEditor(controller is passed as parameter)
- Added
transactionDebounceDurationparameter toBlockNoteEditorfor customizable transaction batching window (default: 400ms) - Improved theme handling with unified color scheme and better support for light and dark modes
- Refactored web editor components for improved error and loading displays
- Enhanced transaction log page in example app with full document retrieval support
- Updated embedded web editor bundle (
assets/web/editor.js)
0.0.9 #
- Added custom schema support with schema config, custom JavaScript/CSS injection, and asset-based scripts/styles for custom blocks, inline content, and styles.
- Added schema config messaging and JavaScript evaluation support in the WebView bridge.
- Refactored Dart models to remove Freezed codegen, add manual JSON serialization, and introduce
BlockNoteBlockContentfor inline/table content with custom block types. - Updated document loading to preload schema config and custom assets when required.
- Updated embedded web editor bundle and example assets for custom schema demos.
0.0.8 #
- Added new block types to Dart models: quote, toggle list, check list, and audio.
- Added typed slash command helpers with safe content escaping.
- Updated example slash command usage to the new helpers.
- Added eager gesture handling for the embedded WebView.
- Updated toolbar popup handling to fully hide intercepted popups.
- Prevented popup portal styling from touching Flutter-hidden popups.
- Marked toggle heading options as toggleable in the web toolbar.
- Updated embedded web editor bundle (
assets/web/editor.js). - Disabled
unnecessary_ignoreto avoid generated-file lint noise.
0.0.7 #
- Improved WebView sizing by using layout constraints for available height.
- Added a modal bottom sheet editor demo in the example app.
- Added a React error boundary and
editablehandling for the embedded editor. - Refined selection auto-scroll to avoid unnecessary scrolls when the keyboard is not visible.
- Improved toolbar popup block type fallback handling for non-JSON values.
- Switched custom slash command execution to a
Functionhandler. - Added analyzer excludes for generated Dart files.
- Added ESLint/Prettier tooling and scripts for the web editor.
- Rebuilt embedded web editor assets (
assets/web).
0.0.6 #
Breaking Changes and Code Quality Improvements
- BREAKING: Removed deprecated
fontFamilyfield fromBlockNoteTheme- Use
fontfield withBlockNoteFontConfiginstead - Removed redundant
effectiveFontFamilygetter (usetheme.font?.familydirectly)
- Use
- Migrated model classes to use
sealed classinstead ofclassfor better type safetyBlockNoteInlineContentandBlockNoteBlocknow use sealed classes- Provides better exhaustiveness checking and type safety
- Fixed linting warnings for
JsonKeyannotations on Freezed constructor parameters
0.0.5-beta #
Major Refactoring and Improvements
- BREAKING: Migrated all model classes from
JsonSerializabletoFreezed- All models now use
@freezedannotation for better immutability and code generation - Removed all custom
fromJson/toJsonconverters - freezed handles serialization automatically - Models now have built-in
copyWithmethods and better type safety
- All models now use
- BREAKING: Fixed
stylestype fromMap<String, bool>toMap<String, dynamic>- Now correctly supports both boolean values (bold, italic, underline, strike) and string values (textColor, backgroundColor)
- Matches BlockNoteJS official schema
- Added comprehensive test suite for document JSON parsing
- Updated example app to load document from JSON file instead of empty document
- Improved code quality and maintainability
0.0.4-beta #
Documentation Improvements
- Added BlockNoteJS banner image and links to BlockNote resources
- Enhanced README with BlockNote feature descriptions
- Added credits section acknowledging BlockNote, Prosemirror, and Tiptap
- Improved README structure and visual presentation
0.0.3-beta #
Code Quality Improvements
- Fixed deprecated API usage: replaced
color.valuewithcolor.toARGB32() - Added ignore comments for deprecated
fontFamilyfield usage (kept for backwards compatibility) - Improved pub.dev static analysis score
0.0.2-beta #
Documentation and Metadata Updates
- Added pub.dev URL and repository links to README
- Added issue tracker link to pubspec.yaml
- Added topics/tags for better discoverability on pub.dev
- Updated README with improved links and metadata
0.0.1-beta #
Beta Release - This is the initial beta release of Flutter BlockNote Editor.
Features #
- WebView integration with BlockNoteJS
- Bidirectional communication between Flutter and JavaScript
- Transaction batching system for efficient updates
- Undo/redo safety implementation
- Support for standard BlockNote blocks (paragraph, heading, list, etc.)
- Custom theme support
- Custom toolbar configuration
- Custom slash commands
- Read-only mode support
- Debug logging support
Known Issues #
- This is a beta version with potential bugs
- BlockNoteJS has known bugs (see GitHub Issues)
- Critical iOS Safari bug: overlapping menus on text selection (BlockNoteJS issue #2122)