@blocknote/core 0.12.0 → 0.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/blocknote.js +958 -940
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +6 -6
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/webpack-stats.json +1 -1
  7. package/package.json +2 -2
  8. package/src/api/getCurrentBlockContentType.ts +14 -0
  9. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +50 -21
  10. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +1 -1
  11. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +18 -5
  12. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +7 -1
  13. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +18 -5
  14. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +14 -5
  15. package/src/editor/BlockNoteEditor.ts +14 -14
  16. package/src/editor/editor.css +0 -1
  17. package/src/extensions/{ImageToolbar → ImagePanel}/ImageToolbarPlugin.ts +14 -14
  18. package/src/extensions/{HyperlinkToolbar/HyperlinkToolbarPlugin.ts → LinkToolbar/LinkToolbarPlugin.ts} +87 -91
  19. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +1 -1
  20. package/src/index.ts +2 -2
  21. package/types/src/api/getCurrentBlockContentType.d.ts +2 -0
  22. package/types/src/editor/BlockNoteEditor.d.ts +5 -5
  23. package/types/src/extensions/{ImageToolbar → ImagePanel}/ImageToolbarPlugin.d.ts +6 -6
  24. package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +40 -0
  25. package/types/src/index.d.ts +2 -2
  26. package/types/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.d.ts +0 -38
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .bn-block-outer{line-height:1.5;transition:margin .2s}.bn-block{display:flex;flex-direction:column}.bn-react-node-view-renderer{display:flex;flex-grow:1}.bn-block-content{padding:3px 0;flex-grow:1;transition:font-size .2s;width:100%}.bn-block-content:before{transition:all .2s}.bn-block-group .bn-block-group{margin-left:1.5em}.bn-block-group .bn-block-group>.bn-block-outer{position:relative}.bn-block-group .bn-block-group>.bn-block-outer:not([data-prev-depth-changed]):before{content:" ";display:inline;position:absolute;left:-20px;height:100%;transition:all .2s .1s}.bn-block-group .bn-block-group>.bn-block-outer[data-prev-depth-change="-2"]:before{height:0}.bn-inline-content code{font-family:monospace}[data-prev-depth-change="1"]{--x: 1}[data-prev-depth-change="2"]{--x: 2}[data-prev-depth-change="3"]{--x: 3}[data-prev-depth-change="4"]{--x: 4}[data-prev-depth-change="5"]{--x: 5}[data-prev-depth-change="-1"]{--x: -1}[data-prev-depth-change="-2"]{--x: -2}[data-prev-depth-change="-3"]{--x: -3}[data-prev-depth-change="-4"]{--x: -4}[data-prev-depth-change="-5"]{--x: -5}.bn-block-outer[data-prev-depth-change]{margin-left:calc(10px * var(--x))}.bn-block-outer[data-prev-depth-change] .bn-block-outer[data-prev-depth-change]{margin-left:0}[data-level="1"]{--level: 3em}[data-level="2"]{--level: 2em}[data-level="3"]{--level: 1.3em}[data-prev-level="1"]{--prev-level: 3em}[data-prev-level="2"]{--prev-level: 2em}[data-prev-level="3"]{--prev-level: 1.3em}.bn-block-outer[data-prev-type=heading]>.bn-block>.bn-block-content{font-size:var(--prev-level);font-weight:700}.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=heading]{font-size:var(--level);font-weight:700}.bn-block-content:before{margin-right:0;content:""}.bn-block-content[data-content-type=numberedListItem]{display:flex;gap:1.2em}[data-content-type=numberedListItem]{--index: attr(data-index)}[data-prev-type=numberedListItem]{--prev-index: attr(data-prev-index)}.bn-block-outer[data-prev-type=numberedListItem]:not([data-prev-index=none])>.bn-block>.bn-block-content:before{content:var(--prev-index) "."}.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=numberedListItem]:before{content:var(--index) "."}.bn-block-content[data-content-type=bulletListItem]{display:flex;gap:1.2em}.bn-block-outer[data-prev-type=bulletListItem]>.bn-block>.bn-block-content:before{content:"•"}.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=bulletListItem]:before{content:"•"}[data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer[data-prev-type=bulletListItem]>.bn-block>.bn-block-content:before{content:"◦"}[data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=bulletListItem]:before{content:"◦"}[data-content-type=bulletListItem]~.bn-block-group [data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer[data-prev-type=bulletListItem]>.bn-block>.bn-block-content:before{content:"▪"}[data-content-type=bulletListItem]~.bn-block-group [data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=bulletListItem]:before{content:"▪"}[data-content-type=image] .bn-image-block-content-wrapper{display:flex;flex-direction:column;justify-content:center;-webkit-user-select:none;user-select:none;width:100%}[data-content-type=image] .bn-add-image-button{display:flex;flex-direction:row;align-items:center;gap:8px;background-color:#f5f5f5;border-radius:4px;cursor:pointer;padding:12px;width:100%}[data-content-type=image] .bn-add-image-button:hover{background-color:#dcdcdc}[data-content-type=image] .bn-add-image-button-icon{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 5H4V19L13.2923 9.70649C13.6828 9.31595 14.3159 9.31591 14.7065 9.70641L20 15.0104V5ZM2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11Z'%3E%3C/path%3E%3C/svg%3E");width:24px;height:24px}[data-content-type=image] .bn-add-image-button-text{color:#000}[data-content-type=image] .bn-image-and-caption-wrapper{display:flex;flex-direction:column;border-radius:4px}[data-content-type=image] .bn-image-wrapper{display:flex;flex-direction:row;align-items:center;position:relative;width:fit-content}[data-content-type=image] .bn-image{border-radius:4px;max-width:100%}[data-content-type=image] .bn-image-resize-handle{position:absolute;width:8px;height:30px;background-color:#000;border:1px solid white;border-radius:4px;cursor:ew-resize}[data-content-type=image] .caption{font-size:.8em}.bn-inline-content:has(>.ProseMirror-trailingBreak):before{pointer-events:none;height:0;position:absolute;font-style:italic}[data-text-color=gray]{color:#9b9a97}[data-text-color=brown]{color:#64473a}[data-text-color=red]{color:#e03e3e}[data-text-color=orange]{color:#d9730d}[data-text-color=yellow]{color:#dfab01}[data-text-color=green]{color:#4d6461}[data-text-color=blue]{color:#0b6e99}[data-text-color=purple]{color:#6940a5}[data-text-color=pink]{color:#ad1a72}[data-background-color=gray]{background-color:#ebeced}[data-background-color=brown]{background-color:#e9e5e3}[data-background-color=red]{background-color:#fbe4e4}[data-background-color=orange]{background-color:#faebdd}[data-background-color=yellow]{background-color:#fbf3db}[data-background-color=green]{background-color:#ddedea}[data-background-color=blue]{background-color:#ddebf1}[data-background-color=purple]{background-color:#eae4f2}[data-background-color=pink]{background-color:#f4dfeb}[data-text-alignment=left]{text-align:left}[data-text-alignment=center]{text-align:center}[data-text-alignment=right]{text-align:right}[data-text-alignment=justify]{text-align:justify}.ProseMirror .tableWrapper{overflow-x:auto}.ProseMirror table{border-collapse:collapse;table-layout:fixed;width:100%;overflow:hidden}.ProseMirror td,.ProseMirror th{vertical-align:top;box-sizing:border-box;position:relative}.ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;z-index:20;background-color:#adf;pointer-events:none}.ProseMirror.resize-cursor{cursor:ew-resize;cursor:col-resize}.ProseMirror .selectedCell:after{z-index:2;position:absolute;content:"";left:0;right:0;top:0;bottom:0;background:rgba(200,200,255,.4);pointer-events:none}.bn-editor{outline:none;padding-inline:54px;--N800: #172b4d;--N40: #dfe1e6}.bn-root{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bn-root *,.bn-root *:before,.bn-root *:after{-webkit-box-sizing:inherit;-moz-box-sizing:inherit;box-sizing:inherit}.bn-default-styles p,.bn-default-styles h1,.bn-default-styles h2,.bn-default-styles h3,.bn-default-styles li{all:unset;margin:0;padding:0;font-size:inherit;min-width:2px!important}.bn-default-styles{font-size:16px;font-weight:400;font-family:Inter,SF Pro Display,-apple-system,BlinkMacSystemFont,Open Sans,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.bn-table-drop-cursor{position:absolute;z-index:20;background-color:#adf;pointer-events:none}.bn-drag-preview{position:absolute;left:-100000px}.collaboration-cursor__caret{border-left:1px solid #0d0d0d;border-right:1px solid #0d0d0d;margin-left:-1px;margin-right:-1px;pointer-events:none;position:relative;word-break:normal}.collaboration-cursor__label{border-radius:3px 3px 3px 0;color:#0d0d0d;font-size:12px;font-style:normal;font-weight:600;left:-1px;line-height:normal;padding:.1rem .3rem;position:absolute;top:-1.4em;-webkit-user-select:none;user-select:none;white-space:nowrap}.bn-editor table{width:auto!important}.bn-editor th,.bn-editor td{min-width:1em;border:1px solid #ddd;padding:3px 5px}.bn-editor .tableWrapper{margin:1em 0}.bn-editor th{font-weight:700;text-align:left}
1
+ .bn-block-outer{line-height:1.5;transition:margin .2s}.bn-block{display:flex;flex-direction:column}.bn-react-node-view-renderer{display:flex;flex-grow:1}.bn-block-content{padding:3px 0;flex-grow:1;transition:font-size .2s;width:100%}.bn-block-content:before{transition:all .2s}.bn-block-group .bn-block-group{margin-left:1.5em}.bn-block-group .bn-block-group>.bn-block-outer{position:relative}.bn-block-group .bn-block-group>.bn-block-outer:not([data-prev-depth-changed]):before{content:" ";display:inline;position:absolute;left:-20px;height:100%;transition:all .2s .1s}.bn-block-group .bn-block-group>.bn-block-outer[data-prev-depth-change="-2"]:before{height:0}.bn-inline-content code{font-family:monospace}[data-prev-depth-change="1"]{--x: 1}[data-prev-depth-change="2"]{--x: 2}[data-prev-depth-change="3"]{--x: 3}[data-prev-depth-change="4"]{--x: 4}[data-prev-depth-change="5"]{--x: 5}[data-prev-depth-change="-1"]{--x: -1}[data-prev-depth-change="-2"]{--x: -2}[data-prev-depth-change="-3"]{--x: -3}[data-prev-depth-change="-4"]{--x: -4}[data-prev-depth-change="-5"]{--x: -5}.bn-block-outer[data-prev-depth-change]{margin-left:calc(10px * var(--x))}.bn-block-outer[data-prev-depth-change] .bn-block-outer[data-prev-depth-change]{margin-left:0}[data-level="1"]{--level: 3em}[data-level="2"]{--level: 2em}[data-level="3"]{--level: 1.3em}[data-prev-level="1"]{--prev-level: 3em}[data-prev-level="2"]{--prev-level: 2em}[data-prev-level="3"]{--prev-level: 1.3em}.bn-block-outer[data-prev-type=heading]>.bn-block>.bn-block-content{font-size:var(--prev-level);font-weight:700}.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=heading]{font-size:var(--level);font-weight:700}.bn-block-content:before{margin-right:0;content:""}.bn-block-content[data-content-type=numberedListItem]{display:flex;gap:1.2em}[data-content-type=numberedListItem]{--index: attr(data-index)}[data-prev-type=numberedListItem]{--prev-index: attr(data-prev-index)}.bn-block-outer[data-prev-type=numberedListItem]:not([data-prev-index=none])>.bn-block>.bn-block-content:before{content:var(--prev-index) "."}.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=numberedListItem]:before{content:var(--index) "."}.bn-block-content[data-content-type=bulletListItem]{display:flex;gap:1.2em}.bn-block-outer[data-prev-type=bulletListItem]>.bn-block>.bn-block-content:before{content:"•"}.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=bulletListItem]:before{content:"•"}[data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer[data-prev-type=bulletListItem]>.bn-block>.bn-block-content:before{content:"◦"}[data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=bulletListItem]:before{content:"◦"}[data-content-type=bulletListItem]~.bn-block-group [data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer[data-prev-type=bulletListItem]>.bn-block>.bn-block-content:before{content:"▪"}[data-content-type=bulletListItem]~.bn-block-group [data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=bulletListItem]:before{content:"▪"}[data-content-type=image] .bn-image-block-content-wrapper{display:flex;flex-direction:column;justify-content:center;-webkit-user-select:none;user-select:none;width:100%}[data-content-type=image] .bn-add-image-button{display:flex;flex-direction:row;align-items:center;gap:8px;background-color:#f5f5f5;border-radius:4px;cursor:pointer;padding:12px;width:100%}[data-content-type=image] .bn-add-image-button:hover{background-color:#dcdcdc}[data-content-type=image] .bn-add-image-button-icon{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 5H4V19L13.2923 9.70649C13.6828 9.31595 14.3159 9.31591 14.7065 9.70641L20 15.0104V5ZM2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11Z'%3E%3C/path%3E%3C/svg%3E");width:24px;height:24px}[data-content-type=image] .bn-add-image-button-text{color:#000}[data-content-type=image] .bn-image-and-caption-wrapper{display:flex;flex-direction:column;border-radius:4px}[data-content-type=image] .bn-image-wrapper{display:flex;flex-direction:row;align-items:center;position:relative;width:fit-content}[data-content-type=image] .bn-image{border-radius:4px;max-width:100%}[data-content-type=image] .bn-image-resize-handle{position:absolute;width:8px;height:30px;background-color:#000;border:1px solid white;border-radius:4px;cursor:ew-resize}[data-content-type=image] .caption{font-size:.8em}.bn-inline-content:has(>.ProseMirror-trailingBreak):before{pointer-events:none;height:0;position:absolute;font-style:italic}[data-text-color=gray]{color:#9b9a97}[data-text-color=brown]{color:#64473a}[data-text-color=red]{color:#e03e3e}[data-text-color=orange]{color:#d9730d}[data-text-color=yellow]{color:#dfab01}[data-text-color=green]{color:#4d6461}[data-text-color=blue]{color:#0b6e99}[data-text-color=purple]{color:#6940a5}[data-text-color=pink]{color:#ad1a72}[data-background-color=gray]{background-color:#ebeced}[data-background-color=brown]{background-color:#e9e5e3}[data-background-color=red]{background-color:#fbe4e4}[data-background-color=orange]{background-color:#faebdd}[data-background-color=yellow]{background-color:#fbf3db}[data-background-color=green]{background-color:#ddedea}[data-background-color=blue]{background-color:#ddebf1}[data-background-color=purple]{background-color:#eae4f2}[data-background-color=pink]{background-color:#f4dfeb}[data-text-alignment=left]{text-align:left}[data-text-alignment=center]{text-align:center}[data-text-alignment=right]{text-align:right}[data-text-alignment=justify]{text-align:justify}.ProseMirror .tableWrapper{overflow-x:auto}.ProseMirror table{border-collapse:collapse;table-layout:fixed;width:100%;overflow:hidden}.ProseMirror td,.ProseMirror th{vertical-align:top;box-sizing:border-box;position:relative}.ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;z-index:20;background-color:#adf;pointer-events:none}.ProseMirror.resize-cursor{cursor:ew-resize;cursor:col-resize}.ProseMirror .selectedCell:after{z-index:2;position:absolute;content:"";left:0;right:0;top:0;bottom:0;background:rgba(200,200,255,.4);pointer-events:none}.bn-editor{outline:none;padding-inline:54px;--N800: #172b4d;--N40: #dfe1e6}.bn-root{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bn-root *,.bn-root *:before,.bn-root *:after{-webkit-box-sizing:inherit;-moz-box-sizing:inherit;box-sizing:inherit}.bn-default-styles p,.bn-default-styles h1,.bn-default-styles h2,.bn-default-styles h3,.bn-default-styles li{margin:0;padding:0;font-size:inherit;min-width:2px!important}.bn-default-styles{font-size:16px;font-weight:400;font-family:Inter,SF Pro Display,-apple-system,BlinkMacSystemFont,Open Sans,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.bn-table-drop-cursor{position:absolute;z-index:20;background-color:#adf;pointer-events:none}.bn-drag-preview{position:absolute;left:-100000px}.collaboration-cursor__caret{border-left:1px solid #0d0d0d;border-right:1px solid #0d0d0d;margin-left:-1px;margin-right:-1px;pointer-events:none;position:relative;word-break:normal}.collaboration-cursor__label{border-radius:3px 3px 3px 0;color:#0d0d0d;font-size:12px;font-style:normal;font-weight:600;left:-1px;line-height:normal;padding:.1rem .3rem;position:absolute;top:-1.4em;-webkit-user-select:none;user-select:none;white-space:nowrap}.bn-editor table{width:auto!important}.bn-editor th,.bn-editor td{min-width:1em;border:1px solid #ddd;padding:3px 5px}.bn-editor .tableWrapper{margin:1em 0}.bn-editor th{font-weight:700;text-align:left}
@@ -1 +1 @@
1
- {"builtAt":1709648347824,"assets":[{"name":"blocknote.umd.cjs","size":103118},{"name":"blocknote.umd.cjs.map","size":464653}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8518,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeConversions.ts","size":11959,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/sharedHTMLConversion.ts","size":2293,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts","size":2687,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":1066,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":704,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":515,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1731,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":3701,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":2781,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1357,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":1627,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":2796,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":9282,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1106,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":2691,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":1862,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":3148,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1002,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":1462,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":1207,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1025,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":757,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":548,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/blockManipulation.ts","size":5738,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":549,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2174,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1054,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":4664,"chunks":["a1ee98a"]},{"name":"./src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts","size":7255,"chunks":["a1ee98a"]},{"name":"./src/extensions/ImageToolbar/ImageToolbarPlugin.ts","size":3500,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":7620,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":14923,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":14755,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/copyExtension.ts","size":2883,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/pasteExtension.ts","size":1131,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":688,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderExtension.ts","size":2880,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":748,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":622,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1594,"chunks":["a1ee98a"]},{"name":"./src/extensions/NonEditableBlocks/NonEditableBlockPlugin.ts","size":467,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4572,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":17235,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":3536,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":1017,"chunks":["a1ee98a"]},{"name":"./src/editor/Block.css","size":17,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":827,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":2514,"chunks":["a1ee98a"]},{"name":"./src/editor/editor.css","size":18,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":22806,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":5302,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":2166,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
1
+ {"builtAt":1711645662316,"assets":[{"name":"blocknote.umd.cjs","size":103230},{"name":"blocknote.umd.cjs.map","size":466910}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8518,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeConversions.ts","size":11959,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/sharedHTMLConversion.ts","size":2293,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts","size":2687,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":1066,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":704,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":515,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1731,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":3701,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":2781,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1357,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":1627,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/api/getCurrentBlockContentType.ts","size":192,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":3439,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":9280,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1151,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":2964,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":1862,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":3421,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1172,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":1462,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":1207,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1025,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":757,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":548,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/blockManipulation.ts","size":5738,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":549,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2174,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1054,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":4664,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":6822,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":7620,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":14923,"chunks":["a1ee98a"]},{"name":"./src/extensions/ImagePanel/ImageToolbarPlugin.ts","size":3482,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":14755,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/copyExtension.ts","size":2883,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/pasteExtension.ts","size":1131,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":688,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderExtension.ts","size":2880,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":748,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":622,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1594,"chunks":["a1ee98a"]},{"name":"./src/extensions/NonEditableBlocks/NonEditableBlockPlugin.ts","size":467,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4572,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":17235,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":3536,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":1017,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":827,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":2514,"chunks":["a1ee98a"]},{"name":"./src/editor/Block.css","size":17,"chunks":["a1ee98a"]},{"name":"./src/editor/editor.css","size":18,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":22844,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":5300,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":2166,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "homepage": "https://github.com/TypeCellOS/BlockNote",
4
4
  "private": false,
5
5
  "license": "MPL-2.0",
6
- "version": "0.12.0",
6
+ "version": "0.12.3",
7
7
  "files": [
8
8
  "dist",
9
9
  "types",
@@ -116,5 +116,5 @@
116
116
  "access": "public",
117
117
  "registry": "https://registry.npmjs.org/"
118
118
  },
119
- "gitHead": "cbc659cd24361817f562981a13cfcef92fbf5da5"
119
+ "gitHead": "fe37d2cd44417828f69538ee3d8ea7f8565c5eb6"
120
120
  }
@@ -0,0 +1,14 @@
1
+ import { Editor } from "@tiptap/core";
2
+ import { getBlockInfoFromPos } from "./getBlockInfoFromPos";
3
+
4
+ // Used to get the content type of the block that the text cursor is in. This is
5
+ // a band-aid fix to prevent input rules and keyboard shortcuts from triggering
6
+ // in tables, but really those should be extended to work with block selections.
7
+ export const getCurrentBlockContentType = (editor: Editor) => {
8
+ const { contentType } = getBlockInfoFromPos(
9
+ editor.state.doc,
10
+ editor.state.selection.from
11
+ );
12
+
13
+ return contentType.spec.content;
14
+ };
@@ -6,6 +6,7 @@ import {
6
6
  } from "../../schema";
7
7
  import { createDefaultBlockDOMOutputSpec } from "../defaultBlockHelpers";
8
8
  import { defaultProps } from "../defaultProps";
9
+ import { getCurrentBlockContentType } from "../../api/getCurrentBlockContentType";
9
10
 
10
11
  export const headingPropSchema = {
11
12
  ...defaultProps,
@@ -45,6 +46,10 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
45
46
  return new InputRule({
46
47
  find: new RegExp(`^(#{${level}})\\s$`),
47
48
  handler: ({ state, chain, range }) => {
49
+ if (getCurrentBlockContentType(this.editor) !== "inline*") {
50
+ return;
51
+ }
52
+
48
53
  chain()
49
54
  .BNUpdateBlock(state.selection.from, {
50
55
  type: "heading",
@@ -62,27 +67,51 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
62
67
 
63
68
  addKeyboardShortcuts() {
64
69
  return {
65
- "Mod-Alt-1": () =>
66
- this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
67
- type: "heading",
68
- props: {
69
- level: 1 as any,
70
- },
71
- }),
72
- "Mod-Alt-2": () =>
73
- this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
74
- type: "heading",
75
- props: {
76
- level: 2 as any,
77
- },
78
- }),
79
- "Mod-Alt-3": () =>
80
- this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
81
- type: "heading",
82
- props: {
83
- level: 3 as any,
84
- },
85
- }),
70
+ "Mod-Alt-1": () => {
71
+ if (getCurrentBlockContentType(this.editor) !== "inline*") {
72
+ return true;
73
+ }
74
+
75
+ return this.editor.commands.BNUpdateBlock(
76
+ this.editor.state.selection.anchor,
77
+ {
78
+ type: "heading",
79
+ props: {
80
+ level: 1 as any,
81
+ },
82
+ }
83
+ );
84
+ },
85
+ "Mod-Alt-2": () => {
86
+ if (getCurrentBlockContentType(this.editor) !== "inline*") {
87
+ return true;
88
+ }
89
+
90
+ return this.editor.commands.BNUpdateBlock(
91
+ this.editor.state.selection.anchor,
92
+ {
93
+ type: "heading",
94
+ props: {
95
+ level: 2 as any,
96
+ },
97
+ }
98
+ );
99
+ },
100
+ "Mod-Alt-3": () => {
101
+ if (getCurrentBlockContentType(this.editor) !== "inline*") {
102
+ return true;
103
+ }
104
+
105
+ return this.editor.commands.BNUpdateBlock(
106
+ this.editor.state.selection.anchor,
107
+ {
108
+ type: "heading",
109
+ props: {
110
+ level: 3 as any,
111
+ },
112
+ }
113
+ );
114
+ },
86
115
  };
87
116
  },
88
117
  parseHTML() {
@@ -234,7 +234,7 @@ export const renderImage = (
234
234
  // Opens the image toolbar.
235
235
  const addImageButtonClickHandler = () => {
236
236
  editor._tiptapEditor.view.dispatch(
237
- editor._tiptapEditor.state.tr.setMeta(editor.imageToolbar!.plugin, {
237
+ editor._tiptapEditor.state.tr.setMeta(editor.imagePanel!.plugin, {
238
238
  block: block,
239
239
  })
240
240
  );
@@ -7,6 +7,7 @@ import {
7
7
  import { createDefaultBlockDOMOutputSpec } from "../../defaultBlockHelpers";
8
8
  import { defaultProps } from "../../defaultProps";
9
9
  import { handleEnter } from "../ListItemKeyboardShortcuts";
10
+ import { getCurrentBlockContentType } from "../../../api/getCurrentBlockContentType";
10
11
 
11
12
  export const bulletListItemPropSchema = {
12
13
  ...defaultProps,
@@ -22,6 +23,10 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
22
23
  new InputRule({
23
24
  find: new RegExp(`^[-+*]\\s$`),
24
25
  handler: ({ state, chain, range }) => {
26
+ if (getCurrentBlockContentType(this.editor) !== "inline*") {
27
+ return;
28
+ }
29
+
25
30
  chain()
26
31
  .BNUpdateBlock(state.selection.from, {
27
32
  type: "bulletListItem",
@@ -37,11 +42,19 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
37
42
  addKeyboardShortcuts() {
38
43
  return {
39
44
  Enter: () => handleEnter(this.editor),
40
- "Mod-Shift-8": () =>
41
- this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
42
- type: "bulletListItem",
43
- props: {},
44
- }),
45
+ "Mod-Shift-8": () => {
46
+ if (getCurrentBlockContentType(this.editor) !== "inline*") {
47
+ return true;
48
+ }
49
+
50
+ return this.editor.commands.BNUpdateBlock(
51
+ this.editor.state.selection.anchor,
52
+ {
53
+ type: "bulletListItem",
54
+ props: {},
55
+ }
56
+ );
57
+ },
45
58
  };
46
59
  },
47
60
 
@@ -10,7 +10,13 @@ export const handleEnter = (editor: Editor) => {
10
10
  const selectionEmpty =
11
11
  editor.state.selection.anchor === editor.state.selection.head;
12
12
 
13
- if (!contentType.name.endsWith("ListItem") || !selectionEmpty) {
13
+ if (
14
+ !(
15
+ contentType.name === "bulletListItem" ||
16
+ contentType.name === "numberedListItem"
17
+ ) ||
18
+ !selectionEmpty
19
+ ) {
14
20
  return false;
15
21
  }
16
22
 
@@ -8,6 +8,7 @@ import { createDefaultBlockDOMOutputSpec } from "../../defaultBlockHelpers";
8
8
  import { defaultProps } from "../../defaultProps";
9
9
  import { handleEnter } from "../ListItemKeyboardShortcuts";
10
10
  import { NumberedListIndexingPlugin } from "./NumberedListIndexingPlugin";
11
+ import { getCurrentBlockContentType } from "../../../api/getCurrentBlockContentType";
11
12
 
12
13
  export const numberedListItemPropSchema = {
13
14
  ...defaultProps,
@@ -37,6 +38,10 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
37
38
  new InputRule({
38
39
  find: new RegExp(`^1\\.\\s$`),
39
40
  handler: ({ state, chain, range }) => {
41
+ if (getCurrentBlockContentType(this.editor) !== "inline*") {
42
+ return;
43
+ }
44
+
40
45
  chain()
41
46
  .BNUpdateBlock(state.selection.from, {
42
47
  type: "numberedListItem",
@@ -52,11 +57,19 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
52
57
  addKeyboardShortcuts() {
53
58
  return {
54
59
  Enter: () => handleEnter(this.editor),
55
- "Mod-Shift-7": () =>
56
- this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
57
- type: "numberedListItem",
58
- props: {},
59
- }),
60
+ "Mod-Shift-7": () => {
61
+ if (getCurrentBlockContentType(this.editor) !== "inline*") {
62
+ return true;
63
+ }
64
+
65
+ return this.editor.commands.BNUpdateBlock(
66
+ this.editor.state.selection.anchor,
67
+ {
68
+ type: "numberedListItem",
69
+ props: {},
70
+ }
71
+ );
72
+ },
60
73
  };
61
74
  },
62
75
 
@@ -5,6 +5,7 @@ import {
5
5
  import { createDefaultBlockDOMOutputSpec } from "../defaultBlockHelpers";
6
6
  import { defaultProps } from "../defaultProps";
7
7
  import { handleEnter } from "../ListItemBlockContent/ListItemKeyboardShortcuts";
8
+ import { getCurrentBlockContentType } from "../../api/getCurrentBlockContentType";
8
9
 
9
10
  export const paragraphPropSchema = {
10
11
  ...defaultProps,
@@ -18,11 +19,19 @@ export const ParagraphBlockContent = createStronglyTypedTiptapNode({
18
19
  addKeyboardShortcuts() {
19
20
  return {
20
21
  Enter: () => handleEnter(this.editor),
21
- "Mod-Alt-0": () =>
22
- this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
23
- type: "paragraph",
24
- props: {},
25
- }),
22
+ "Mod-Alt-0": () => {
23
+ if (getCurrentBlockContentType(this.editor) !== "inline*") {
24
+ return true;
25
+ }
26
+
27
+ return this.editor.commands.BNUpdateBlock(
28
+ this.editor.state.selection.anchor,
29
+ {
30
+ type: "paragraph",
31
+ props: {},
32
+ }
33
+ );
34
+ },
26
35
  };
27
36
  },
28
37
 
@@ -27,10 +27,10 @@ import {
27
27
  PartialBlock,
28
28
  } from "../blocks/defaultBlocks";
29
29
  import { FormattingToolbarProsemirrorPlugin } from "../extensions/FormattingToolbar/FormattingToolbarPlugin";
30
- import { HyperlinkToolbarProsemirrorPlugin } from "../extensions/HyperlinkToolbar/HyperlinkToolbarPlugin";
31
- import { ImageToolbarProsemirrorPlugin } from "../extensions/ImageToolbar/ImageToolbarPlugin";
30
+ import { LinkToolbarProsemirrorPlugin } from "../extensions/LinkToolbar/LinkToolbarPlugin";
32
31
  import { SideMenuProsemirrorPlugin } from "../extensions/SideMenu/SideMenuPlugin";
33
32
  import { SuggestionMenuProseMirrorPlugin } from "../extensions/SuggestionMenu/SuggestionPlugin";
33
+ import { ImagePanelProsemirrorPlugin } from "../extensions/ImagePanel/ImageToolbarPlugin";
34
34
  import { TableHandlesProsemirrorPlugin } from "../extensions/TableHandles/TableHandlesPlugin";
35
35
  import { UniqueID } from "../extensions/UniqueID/UniqueID";
36
36
  import {
@@ -54,14 +54,15 @@ import { TextCursorPosition } from "./cursorPositionTypes";
54
54
  import { Selection } from "./selectionTypes";
55
55
  import { transformPasted } from "./transformPasted";
56
56
 
57
- // CSS
58
57
  import { checkDefaultBlockTypeInSchema } from "../blocks/defaultBlockTypeGuards";
59
- import "./Block.css";
60
58
  import { BlockNoteSchema } from "./BlockNoteSchema";
61
59
  import {
62
60
  BlockNoteTipTapEditor,
63
61
  BlockNoteTipTapEditorOptions,
64
62
  } from "./BlockNoteTipTapEditor";
63
+
64
+ // CSS
65
+ import "./Block.css";
65
66
  import "./editor.css";
66
67
 
67
68
  export type BlockNoteEditorOptions<
@@ -156,7 +157,7 @@ export class BlockNoteEditor<
156
157
  public readonly styleImplementations: StyleSpecs;
157
158
 
158
159
  public readonly formattingToolbar: FormattingToolbarProsemirrorPlugin;
159
- public readonly hyperlinkToolbar: HyperlinkToolbarProsemirrorPlugin<
160
+ public readonly linkToolbar: LinkToolbarProsemirrorPlugin<
160
161
  BSchema,
161
162
  ISchema,
162
163
  SSchema
@@ -171,10 +172,7 @@ export class BlockNoteEditor<
171
172
  ISchema,
172
173
  SSchema
173
174
  >;
174
- public readonly imageToolbar?: ImageToolbarProsemirrorPlugin<
175
- ISchema,
176
- SSchema
177
- >;
175
+ public readonly imagePanel?: ImagePanelProsemirrorPlugin<ISchema, SSchema>;
178
176
  public readonly tableHandles?: TableHandlesProsemirrorPlugin<
179
177
  ISchema,
180
178
  SSchema
@@ -232,12 +230,12 @@ export class BlockNoteEditor<
232
230
  this.styleImplementations = newOptions.schema.styleSpecs;
233
231
 
234
232
  this.formattingToolbar = new FormattingToolbarProsemirrorPlugin(this);
235
- this.hyperlinkToolbar = new HyperlinkToolbarProsemirrorPlugin(this);
233
+ this.linkToolbar = new LinkToolbarProsemirrorPlugin(this);
236
234
  this.sideMenu = new SideMenuProsemirrorPlugin(this);
237
235
  this.suggestionMenus = new SuggestionMenuProseMirrorPlugin(this);
238
236
  if (checkDefaultBlockTypeInSchema("image", this)) {
239
237
  // Type guards only work on `const`s? Not working for `this`
240
- this.imageToolbar = new ImageToolbarProsemirrorPlugin(this as any);
238
+ this.imagePanel = new ImagePanelProsemirrorPlugin(this as any);
241
239
  }
242
240
  if (checkDefaultBlockTypeInSchema("table", this)) {
243
241
  this.tableHandles = new TableHandlesProsemirrorPlugin(this as any);
@@ -260,10 +258,10 @@ export class BlockNoteEditor<
260
258
  addProseMirrorPlugins: () => {
261
259
  return [
262
260
  this.formattingToolbar.plugin,
263
- this.hyperlinkToolbar.plugin,
261
+ this.linkToolbar.plugin,
264
262
  this.sideMenu.plugin,
265
263
  this.suggestionMenus.plugin,
266
- ...(this.imageToolbar ? [this.imageToolbar.plugin] : []),
264
+ ...(this.imagePanel ? [this.imagePanel.plugin] : []),
267
265
  ...(this.tableHandles ? [this.tableHandles.plugin] : []),
268
266
  ];
269
267
  },
@@ -654,7 +652,9 @@ export class BlockNoteEditor<
654
652
  * @param editable True to make the editor editable, or false to lock it.
655
653
  */
656
654
  public set isEditable(editable: boolean) {
657
- this._tiptapEditor.setEditable(editable);
655
+ if (this._tiptapEditor.options.editable !== editable) {
656
+ this._tiptapEditor.setEditable(editable);
657
+ }
658
658
  }
659
659
 
660
660
  /**
@@ -36,7 +36,6 @@ Tippy popups that are appended to document.body directly
36
36
  .bn-default-styles h2,
37
37
  .bn-default-styles h3,
38
38
  .bn-default-styles li {
39
- all: unset;
40
39
  margin: 0;
41
40
  padding: 0;
42
41
  font-size: inherit;
@@ -11,7 +11,7 @@ import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
11
11
  import { EventEmitter } from "../../util/EventEmitter";
12
12
  import { DefaultBlockSchema } from "../../blocks/defaultBlocks";
13
13
 
14
- export type ImageToolbarState<
14
+ export type ImagePanelState<
15
15
  I extends InlineContentSchema,
16
16
  S extends StyleSchema
17
17
  > = UiElementPosition & {
@@ -19,11 +19,11 @@ export type ImageToolbarState<
19
19
  block: BlockFromConfig<DefaultBlockSchema["image"], I, S>;
20
20
  };
21
21
 
22
- export class ImageToolbarView<
22
+ export class ImagePanelView<
23
23
  I extends InlineContentSchema,
24
24
  S extends StyleSchema
25
25
  > {
26
- public state?: ImageToolbarState<I, S>;
26
+ public state?: ImagePanelState<I, S>;
27
27
  public emitUpdate: () => void;
28
28
 
29
29
  public prevWasEditable: boolean | null = null;
@@ -31,11 +31,11 @@ export class ImageToolbarView<
31
31
  constructor(
32
32
  private readonly pluginKey: PluginKey,
33
33
  private readonly pmView: EditorView,
34
- emitUpdate: (state: ImageToolbarState<I, S>) => void
34
+ emitUpdate: (state: ImagePanelState<I, S>) => void
35
35
  ) {
36
36
  this.emitUpdate = () => {
37
37
  if (!this.state) {
38
- throw new Error("Attempting to update uninitialized image toolbar");
38
+ throw new Error("Attempting to update uninitialized image panel");
39
39
  }
40
40
 
41
41
  emitUpdate(this.state);
@@ -69,7 +69,7 @@ export class ImageToolbarView<
69
69
  const editorWrapper = this.pmView.dom.parentElement!;
70
70
 
71
71
  // Checks if the focus is moving to an element outside the editor. If it is,
72
- // the toolbar is hidden.
72
+ // the panel is hidden.
73
73
  if (
74
74
  // An element is clicked.
75
75
  event &&
@@ -142,13 +142,13 @@ export class ImageToolbarView<
142
142
  }
143
143
  }
144
144
 
145
- const imageToolbarPluginKey = new PluginKey("ImageToolbarPlugin");
145
+ const imagePanelPluginKey = new PluginKey("ImagePanelPlugin");
146
146
 
147
- export class ImageToolbarProsemirrorPlugin<
147
+ export class ImagePanelProsemirrorPlugin<
148
148
  I extends InlineContentSchema,
149
149
  S extends StyleSchema
150
150
  > extends EventEmitter<any> {
151
- private view: ImageToolbarView<I, S> | undefined;
151
+ private view: ImagePanelView<I, S> | undefined;
152
152
  public readonly plugin: Plugin;
153
153
 
154
154
  constructor(
@@ -158,11 +158,11 @@ export class ImageToolbarProsemirrorPlugin<
158
158
  this.plugin = new Plugin<{
159
159
  block: BlockFromConfig<DefaultBlockSchema["image"], I, S> | undefined;
160
160
  }>({
161
- key: imageToolbarPluginKey,
161
+ key: imagePanelPluginKey,
162
162
  view: (editorView) => {
163
- this.view = new ImageToolbarView(
163
+ this.view = new ImagePanelView(
164
164
  // editor,
165
- imageToolbarPluginKey,
165
+ imagePanelPluginKey,
166
166
  editorView,
167
167
  (state) => {
168
168
  this.emit("update", state);
@@ -179,7 +179,7 @@ export class ImageToolbarProsemirrorPlugin<
179
179
  apply: (transaction) => {
180
180
  const block:
181
181
  | BlockFromConfig<DefaultBlockSchema["image"], I, S>
182
- | undefined = transaction.getMeta(imageToolbarPluginKey)?.block;
182
+ | undefined = transaction.getMeta(imagePanelPluginKey)?.block;
183
183
 
184
184
  return {
185
185
  block,
@@ -189,7 +189,7 @@ export class ImageToolbarProsemirrorPlugin<
189
189
  });
190
190
  }
191
191
 
192
- public onUpdate(callback: (state: ImageToolbarState<I, S>) => void) {
192
+ public onUpdate(callback: (state: ImagePanelState<I, S>) => void) {
193
193
  return this.on("update", callback);
194
194
  }
195
195
  }