@blocknote/core 0.13.4 → 0.14.0
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.
- package/dist/blocknote.js +526 -477
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +5 -5
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +29 -29
- package/src/api/blockManipulation/__snapshots__/blockManipulation.test.ts.snap +98 -0
- package/src/api/blockManipulation/blockManipulation.test.ts +86 -7
- package/src/api/exporters/html/__snapshots__/customBlock/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/customBlock/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/internal.html +1 -0
- package/src/api/exporters/markdown/__snapshots__/customBlock/basic/markdown.md +5 -0
- package/src/api/exporters/markdown/__snapshots__/customParagraph/lineBreaks/markdown.md +1 -0
- package/src/api/exporters/markdown/__snapshots__/paragraph/lineBreaks/markdown.md +2 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +566 -0
- package/src/api/nodeConversions/nodeConversions.test.ts +2 -0
- package/src/api/nodeConversions/nodeConversions.ts +2 -4
- package/src/api/parsers/html/__snapshots__/paste/parse-image-in-paragraph.json +16 -0
- package/src/api/parsers/html/parseHTML.test.ts +8 -0
- package/src/api/parsers/pasteExtension.ts +5 -0
- package/src/api/testUtil/cases/customBlocks.ts +9 -0
- package/src/api/testUtil/cases/defaultSchema.ts +9 -0
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +6 -6
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +7 -2
- package/src/blocks/TableBlockContent/TableBlockContent.ts +23 -1
- package/src/editor/Block.css +2 -3
- package/src/editor/BlockNoteEditor.ts +7 -6
- package/src/editor/BlockNoteExtensions.ts +10 -1
- package/src/editor/BlockNoteTipTapEditor.ts +1 -0
- package/src/extensions/FilePanel/FilePanelPlugin.ts +16 -12
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +12 -15
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +6 -2
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +5 -1
- package/src/extensions/SideMenu/SideMenuPlugin.ts +157 -118
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +5 -2
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +7 -4
- package/src/i18n/locales/pt.ts +1 -1
- package/src/i18n/locales/zh.ts +1 -1
- package/src/pm-nodes/BlockContainer.ts +11 -7
- package/src/schema/blocks/createSpec.ts +2 -2
- package/src/schema/inlineContent/createSpec.ts +2 -2
- package/types/src/editor/BlockNoteEditor.d.ts +1 -1
- package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +5 -5
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +0 -1
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +9 -8
- package/types/src/schema/blocks/createSpec.d.ts +2 -2
- package/types/src/schema/inlineContent/createSpec.d.ts +2 -2
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-block-content{display:flex;padding:3px 0;transition:font-size .2s;width:100%}.bn-block-content:before{transition:all .2s}.bn-block-content.ProseMirror-selectednode>*,.ProseMirror-selectednode>.bn-block-content>*{border-radius:4px;outline:4px solid rgb(100,160,255)}.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-content[data-content-type=checkListItem]>div{display:flex}.bn-block-content[data-content-type=checkListItem]>div>div>input{margin:0 1.2em 0 0;cursor:pointer}.bn-block-content[data-content-type=checkListItem][data-checked=true] .bn-inline-content{text-decoration:line-through}.bn-block-content[data-text-alignment=center]{justify-content:center}.bn-block-content[data-text-alignment=right]{justify-content:flex-end}.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-file-block] .bn-file-block-content-wrapper:has(.bn-add-file-button),[data-file-block] .bn-file-block-content-wrapper:has(.bn-file-default-preview){width:100%}[data-file-block] .bn-file-block-content-wrapper{cursor:pointer;display:flex;flex-direction:column;justify-content:stretch;-webkit-user-select:none;user-select:none}[data-file-block] .bn-add-file-button{align-items:center;background-color:#f2f1ee;border-radius:4px;color:#7d797a;
|
|
1
|
+
.bn-block-outer{line-height:1.5;transition:margin .2s}.bn-block{display:flex;flex-direction:column}.bn-block-content{display:flex;padding:3px 0;transition:font-size .2s;width:100%}.bn-block-content:before{transition:all .2s}.bn-block-content.ProseMirror-selectednode>*,.ProseMirror-selectednode>.bn-block-content>*{border-radius:4px;outline:4px solid rgb(100,160,255)}.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-content[data-content-type=checkListItem]>div{display:flex}.bn-block-content[data-content-type=checkListItem]>div>div>input{margin:0 1.2em 0 0;cursor:pointer}.bn-block-content[data-content-type=checkListItem][data-checked=true] .bn-inline-content{text-decoration:line-through}.bn-block-content[data-text-alignment=center]{justify-content:center}.bn-block-content[data-text-alignment=right]{justify-content:flex-end}.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-file-block] .bn-file-block-content-wrapper:has(.bn-add-file-button),[data-file-block] .bn-file-block-content-wrapper:has(.bn-file-default-preview){width:100%}[data-file-block] .bn-file-block-content-wrapper{cursor:pointer;display:flex;flex-direction:column;justify-content:stretch;-webkit-user-select:none;user-select:none}[data-file-block] .bn-add-file-button{align-items:center;background-color:#f2f1ee;border-radius:4px;color:#7d797a;display:flex;flex-direction:row;gap:10px;padding:12px;width:100%}.bn-editor[contenteditable=true] [data-file-block] .bn-add-file-button:hover{background-color:#e1e1e1}[data-file-block] .bn-add-file-button-icon{width:24px;height:24px}[data-file-block] .bn-add-file-button .bn-add-file-button-text{font-size:.9rem}[data-file-block] .bn-file-and-caption-wrapper{display:flex;flex-direction:column;border-radius:4px}[data-file-block] .bn-file-default-preview{align-items:center;border-radius:4px;display:flex;flex-direction:row;gap:4px;padding:4px;width:100%}[data-file-block] .bn-file-default-preview:hover,.ProseMirror-selectednode .bn-file-default-preview{background-color:#e1e1e1}[data-file-block] .bn-file-default-preview-icon{width:24px;height:24px}[data-file-block] .bn-visual-media-wrapper{display:flex;flex-direction:row;align-items:center;position:relative;width:fit-content}[data-file-block] .bn-visual-media{border-radius:4px;max-width:100%}[data-file-block] .bn-visual-media-resize-handle{position:absolute;width:8px;height:30px;background-color:#000;border:1px solid white;border-radius:4px;cursor:ew-resize}[data-content-type=audio]>.bn-file-block-content-wrapper,.bn-audio{width:100%}[data-file-block] .bn-file-caption{font-size:.8em;padding-block:4px}[data-file-block] .bn-file-caption:empty{padding-block:0}.bn-inline-content:has(>.ProseMirror-trailingBreak:only-child):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]{justify-content:flex-start;text-align:left}[data-text-alignment=center]{justify-content:center;text-align:center}[data-text-alignment=right]{justify-content:flex-end;text-align:right}[data-text-alignment=justify]{justify-content:flex-start;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}
|
package/dist/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1717710248883,"assets":[{"name":"blocknote.umd.cjs","size":166801},{"name":"blocknote.umd.cjs.map","size":630937}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/i18n/locales/en.ts","size":6512,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":7122,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":6695,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":6185,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":5879,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":6834,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":6595,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":6785,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":6643,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":5872,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"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":331,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeConversions.ts","size":11998,"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":1107,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":704,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":536,"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":299,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":3877,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":2814,"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/blocks/FileBlockContent/fileBlockHelpers.ts","size":8593,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/FileBlockContent.ts","size":1939,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/imageBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":3959,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/videoBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/VideoBlockContent.ts","size":3763,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/audioBlockHelpers.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/AudioBlockContent.ts","size":3741,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"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/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1201,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":3122,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":1862,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":3437,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","size":6423,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1307,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":1462,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":1624,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1123,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":1331,"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/util/addSpacesToCheckboxesRehypePlugin.ts","size":775,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":576,"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/FilePanel/FilePanelPlugin.ts","size":3453,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":4344,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":7285,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":7658,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":16427,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":14834,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/copyExtension.ts","size":2883,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/pasteExtension.ts","size":1211,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":688,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":825,"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":1014,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4578,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":18112,"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":4090,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":1062,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":1044,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":2655,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderPlugin.ts","size":2399,"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":23040,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":6248,"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.
|
|
6
|
+
"version": "0.14.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"types",
|
|
@@ -54,32 +54,32 @@
|
|
|
54
54
|
"clean": "rimraf dist && rimraf types"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@tiptap/core": "^2.0
|
|
58
|
-
"@tiptap/extension-bold": "^2.0
|
|
59
|
-
"@tiptap/extension-code": "^2.0
|
|
60
|
-
"@tiptap/extension-collaboration": "^2.0
|
|
61
|
-
"@tiptap/extension-collaboration-cursor": "^2.0
|
|
62
|
-
"@tiptap/extension-dropcursor": "^2.0
|
|
63
|
-
"@tiptap/extension-gapcursor": "^2.0
|
|
64
|
-
"@tiptap/extension-hard-break": "^2.0
|
|
65
|
-
"@tiptap/extension-history": "^2.0
|
|
66
|
-
"@tiptap/extension-horizontal-rule": "^2.0
|
|
67
|
-
"@tiptap/extension-italic": "^2.0
|
|
68
|
-
"@tiptap/extension-link": "^2.0
|
|
69
|
-
"@tiptap/extension-paragraph": "^2.0
|
|
70
|
-
"@tiptap/extension-strike": "^2.0
|
|
71
|
-
"@tiptap/extension-table-cell": "^2.0
|
|
72
|
-
"@tiptap/extension-table-header": "^2.0
|
|
73
|
-
"@tiptap/extension-table-row": "^2.0
|
|
74
|
-
"@tiptap/extension-text": "^2.0
|
|
75
|
-
"@tiptap/extension-underline": "^2.0
|
|
76
|
-
"@tiptap/pm": "^2.0
|
|
57
|
+
"@tiptap/core": "^2.4.0",
|
|
58
|
+
"@tiptap/extension-bold": "^2.4.0",
|
|
59
|
+
"@tiptap/extension-code": "^2.4.0",
|
|
60
|
+
"@tiptap/extension-collaboration": "^2.4.0",
|
|
61
|
+
"@tiptap/extension-collaboration-cursor": "^2.4.0",
|
|
62
|
+
"@tiptap/extension-dropcursor": "^2.4.0",
|
|
63
|
+
"@tiptap/extension-gapcursor": "^2.4.0",
|
|
64
|
+
"@tiptap/extension-hard-break": "^2.4.0",
|
|
65
|
+
"@tiptap/extension-history": "^2.4.0",
|
|
66
|
+
"@tiptap/extension-horizontal-rule": "^2.4.0",
|
|
67
|
+
"@tiptap/extension-italic": "^2.4.0",
|
|
68
|
+
"@tiptap/extension-link": "^2.4.0",
|
|
69
|
+
"@tiptap/extension-paragraph": "^2.4.0",
|
|
70
|
+
"@tiptap/extension-strike": "^2.4.0",
|
|
71
|
+
"@tiptap/extension-table-cell": "^2.4.0",
|
|
72
|
+
"@tiptap/extension-table-header": "^2.4.0",
|
|
73
|
+
"@tiptap/extension-table-row": "^2.4.0",
|
|
74
|
+
"@tiptap/extension-text": "^2.4.0",
|
|
75
|
+
"@tiptap/extension-underline": "^2.4.0",
|
|
76
|
+
"@tiptap/pm": "^2.4.0",
|
|
77
77
|
"hast-util-from-dom": "^4.2.0",
|
|
78
|
-
"prosemirror-model": "^1.
|
|
78
|
+
"prosemirror-model": "^1.21.0",
|
|
79
79
|
"prosemirror-state": "^1.4.3",
|
|
80
|
-
"prosemirror-tables": "^1.3.
|
|
81
|
-
"prosemirror-transform": "^1.
|
|
82
|
-
"prosemirror-view": "^1.
|
|
80
|
+
"prosemirror-tables": "^1.3.7",
|
|
81
|
+
"prosemirror-transform": "^1.9.0",
|
|
82
|
+
"prosemirror-view": "^1.33.7",
|
|
83
83
|
"rehype-format": "^5.0.0",
|
|
84
84
|
"rehype-parse": "^8.0.4",
|
|
85
85
|
"rehype-remark": "^9.1.2",
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
"remark-stringify": "^10.0.2",
|
|
91
91
|
"unified": "^10.1.2",
|
|
92
92
|
"uuid": "^8.3.2",
|
|
93
|
-
"y-prosemirror": "1.2.
|
|
94
|
-
"y-protocols": "^1.0.
|
|
95
|
-
"yjs": "^13.6.
|
|
93
|
+
"y-prosemirror": "1.2.5",
|
|
94
|
+
"y-protocols": "^1.0.6",
|
|
95
|
+
"yjs": "^13.6.15"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@types/hast": "^2.3.4",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"access": "public",
|
|
117
117
|
"registry": "https://registry.npmjs.org/"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "51cf600ac354d1fe76c207ec5726c9cd365f06a3"
|
|
120
120
|
}
|
|
@@ -614,3 +614,101 @@ exports[`Inserting Blocks with Different Placements > Insert nested inside exist
|
|
|
614
614
|
},
|
|
615
615
|
]
|
|
616
616
|
`;
|
|
617
|
+
|
|
618
|
+
exports[`Update Line Breaks > Update custom block with line break 1`] = `
|
|
619
|
+
[
|
|
620
|
+
{
|
|
621
|
+
"children": [],
|
|
622
|
+
"content": [
|
|
623
|
+
{
|
|
624
|
+
"styles": {},
|
|
625
|
+
"text": "Line1
|
|
626
|
+
Line2",
|
|
627
|
+
"type": "text",
|
|
628
|
+
},
|
|
629
|
+
],
|
|
630
|
+
"id": "1",
|
|
631
|
+
"props": {
|
|
632
|
+
"backgroundColor": "default",
|
|
633
|
+
"textAlignment": "left",
|
|
634
|
+
"textColor": "default",
|
|
635
|
+
},
|
|
636
|
+
"type": "paragraph",
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"children": [],
|
|
640
|
+
"content": [
|
|
641
|
+
{
|
|
642
|
+
"styles": {},
|
|
643
|
+
"text": "Updated Custom Block with
|
|
644
|
+
line
|
|
645
|
+
break",
|
|
646
|
+
"type": "text",
|
|
647
|
+
},
|
|
648
|
+
],
|
|
649
|
+
"id": "2",
|
|
650
|
+
"props": {},
|
|
651
|
+
"type": "customBlock",
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"children": [],
|
|
655
|
+
"content": [],
|
|
656
|
+
"id": "0",
|
|
657
|
+
"props": {
|
|
658
|
+
"backgroundColor": "default",
|
|
659
|
+
"textAlignment": "left",
|
|
660
|
+
"textColor": "default",
|
|
661
|
+
},
|
|
662
|
+
"type": "paragraph",
|
|
663
|
+
},
|
|
664
|
+
]
|
|
665
|
+
`;
|
|
666
|
+
|
|
667
|
+
exports[`Update Line Breaks > Update paragraph with line break 1`] = `
|
|
668
|
+
[
|
|
669
|
+
{
|
|
670
|
+
"children": [],
|
|
671
|
+
"content": [
|
|
672
|
+
{
|
|
673
|
+
"styles": {},
|
|
674
|
+
"text": "Updated Custom Block with
|
|
675
|
+
line
|
|
676
|
+
break",
|
|
677
|
+
"type": "text",
|
|
678
|
+
},
|
|
679
|
+
],
|
|
680
|
+
"id": "1",
|
|
681
|
+
"props": {
|
|
682
|
+
"backgroundColor": "default",
|
|
683
|
+
"textAlignment": "left",
|
|
684
|
+
"textColor": "default",
|
|
685
|
+
},
|
|
686
|
+
"type": "paragraph",
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"children": [],
|
|
690
|
+
"content": [
|
|
691
|
+
{
|
|
692
|
+
"styles": {},
|
|
693
|
+
"text": "Line1
|
|
694
|
+
Line2",
|
|
695
|
+
"type": "text",
|
|
696
|
+
},
|
|
697
|
+
],
|
|
698
|
+
"id": "2",
|
|
699
|
+
"props": {},
|
|
700
|
+
"type": "customBlock",
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
"children": [],
|
|
704
|
+
"content": [],
|
|
705
|
+
"id": "0",
|
|
706
|
+
"props": {
|
|
707
|
+
"backgroundColor": "default",
|
|
708
|
+
"textAlignment": "left",
|
|
709
|
+
"textColor": "default",
|
|
710
|
+
},
|
|
711
|
+
"type": "paragraph",
|
|
712
|
+
},
|
|
713
|
+
]
|
|
714
|
+
`;
|
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
2
|
import {
|
|
3
3
|
Block,
|
|
4
|
-
|
|
4
|
+
defaultBlockSpecs,
|
|
5
5
|
DefaultInlineContentSchema,
|
|
6
6
|
DefaultStyleSchema,
|
|
7
7
|
PartialBlock,
|
|
8
8
|
} from "../../blocks/defaultBlocks";
|
|
9
9
|
import { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
10
|
+
import { createBlockSpec } from "../../schema";
|
|
11
|
+
import { BlockNoteSchema } from "../../editor/BlockNoteSchema";
|
|
12
|
+
|
|
13
|
+
const CustomBlock = createBlockSpec(
|
|
14
|
+
{
|
|
15
|
+
type: "customBlock",
|
|
16
|
+
propSchema: {},
|
|
17
|
+
content: "inline",
|
|
18
|
+
} as const,
|
|
19
|
+
{
|
|
20
|
+
render: () => {
|
|
21
|
+
const dom = document.createElement("div");
|
|
22
|
+
dom.className = "custom-block";
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
dom: dom,
|
|
26
|
+
contentDOM: dom,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const schema = BlockNoteSchema.create({
|
|
33
|
+
blockSpecs: {
|
|
34
|
+
...defaultBlockSpecs,
|
|
35
|
+
customBlock: CustomBlock,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
10
38
|
|
|
11
|
-
let editor: BlockNoteEditor
|
|
39
|
+
let editor: BlockNoteEditor<typeof schema.blockSchema>;
|
|
12
40
|
const div = document.createElement("div");
|
|
13
41
|
|
|
14
42
|
function waitForEditor() {
|
|
@@ -23,13 +51,19 @@ function waitForEditor() {
|
|
|
23
51
|
}
|
|
24
52
|
|
|
25
53
|
let singleBlock: PartialBlock<
|
|
26
|
-
|
|
54
|
+
typeof schema.blockSchema,
|
|
27
55
|
DefaultInlineContentSchema,
|
|
28
56
|
DefaultStyleSchema
|
|
29
57
|
>;
|
|
30
58
|
|
|
31
59
|
let multipleBlocks: PartialBlock<
|
|
32
|
-
|
|
60
|
+
typeof schema.blockSchema,
|
|
61
|
+
DefaultInlineContentSchema,
|
|
62
|
+
DefaultStyleSchema
|
|
63
|
+
>[];
|
|
64
|
+
|
|
65
|
+
let blocksWithLineBreaks: PartialBlock<
|
|
66
|
+
typeof schema.blockSchema,
|
|
33
67
|
DefaultInlineContentSchema,
|
|
34
68
|
DefaultStyleSchema
|
|
35
69
|
>[];
|
|
@@ -37,13 +71,16 @@ let multipleBlocks: PartialBlock<
|
|
|
37
71
|
let insert: (
|
|
38
72
|
placement: "before" | "nested" | "after"
|
|
39
73
|
) => Block<
|
|
40
|
-
|
|
74
|
+
typeof schema.blockSchema,
|
|
41
75
|
DefaultInlineContentSchema,
|
|
42
76
|
DefaultStyleSchema
|
|
43
77
|
>[];
|
|
44
78
|
|
|
45
79
|
beforeEach(() => {
|
|
46
|
-
editor = BlockNoteEditor.create(
|
|
80
|
+
editor = BlockNoteEditor.create<typeof schema.blockSchema>({
|
|
81
|
+
schema: schema,
|
|
82
|
+
});
|
|
83
|
+
|
|
47
84
|
editor.mount(div);
|
|
48
85
|
|
|
49
86
|
singleBlock = {
|
|
@@ -86,6 +123,17 @@ beforeEach(() => {
|
|
|
86
123
|
},
|
|
87
124
|
];
|
|
88
125
|
|
|
126
|
+
blocksWithLineBreaks = [
|
|
127
|
+
{
|
|
128
|
+
type: "paragraph",
|
|
129
|
+
content: "Line1\nLine2",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: "customBlock",
|
|
133
|
+
content: "Line1\nLine2",
|
|
134
|
+
},
|
|
135
|
+
];
|
|
136
|
+
|
|
89
137
|
insert = (placement) => {
|
|
90
138
|
const existingBlock = editor.document[0];
|
|
91
139
|
editor.insertBlocks(multipleBlocks, existingBlock, placement);
|
|
@@ -122,7 +170,7 @@ describe("Test strong typing", () => {
|
|
|
122
170
|
{
|
|
123
171
|
type: "paragraph",
|
|
124
172
|
props: {
|
|
125
|
-
// @ts-expect-error
|
|
173
|
+
// @ts-expect-error invalid type
|
|
126
174
|
level: 1,
|
|
127
175
|
},
|
|
128
176
|
}
|
|
@@ -236,3 +284,34 @@ describe("Insert, Update, & Delete Blocks", () => {
|
|
|
236
284
|
expect(editor.document).toMatchSnapshot();
|
|
237
285
|
});
|
|
238
286
|
});
|
|
287
|
+
|
|
288
|
+
describe("Update Line Breaks", () => {
|
|
289
|
+
it("Update paragraph with line break", async () => {
|
|
290
|
+
await waitForEditor();
|
|
291
|
+
|
|
292
|
+
const existingBlock = editor.document[0];
|
|
293
|
+
editor.insertBlocks(blocksWithLineBreaks, existingBlock);
|
|
294
|
+
|
|
295
|
+
const newBlock = editor.document[0];
|
|
296
|
+
editor.updateBlock(newBlock, {
|
|
297
|
+
type: "paragraph",
|
|
298
|
+
content: "Updated Custom Block with \nline \nbreak",
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
expect(editor.document).toMatchSnapshot();
|
|
302
|
+
});
|
|
303
|
+
it("Update custom block with line break", async () => {
|
|
304
|
+
await waitForEditor();
|
|
305
|
+
|
|
306
|
+
const existingBlock = editor.document[0];
|
|
307
|
+
editor.insertBlocks(blocksWithLineBreaks, existingBlock);
|
|
308
|
+
|
|
309
|
+
const newBlock = editor.document[1];
|
|
310
|
+
editor.updateBlock(newBlock, {
|
|
311
|
+
type: "customBlock",
|
|
312
|
+
content: "Updated Custom Block with \nline \nbreak",
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
expect(editor.document).toMatchSnapshot();
|
|
316
|
+
});
|
|
317
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="bn-inline-content custom-block" data-editable="">Custom customBlock</div><div class="bn-inline-content custom-block" data-editable="">Custom customBlock <br>with <br>line breaks</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="bn-block-group" data-node-type="blockGroup"><div class="bn-block-outer" data-node-type="blockOuter" data-id="1"><div class="bn-block" data-node-type="blockContainer" data-id="1"><div class="bn-block-content" data-content-type="customBlock"><div class="bn-inline-content custom-block" data-editable="">Custom customBlock</div></div></div></div><div class="bn-block-outer" data-node-type="blockOuter" data-id="2"><div class="bn-block" data-node-type="blockContainer" data-id="2"><div class="bn-block-content" data-content-type="customBlock"><div class="bn-inline-content custom-block" data-editable="">Custom customBlock <br>with <br>line breaks</div></div></div></div></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="custom-paragraph">Hello World</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="bn-block-group" data-node-type="blockGroup"><div class="bn-block-outer" data-node-type="blockOuter" data-id="1"><div class="bn-block" data-node-type="blockContainer" data-id="1"><div class="bn-block-content" data-content-type="customParagraph"><p class="bn-inline-content custom-paragraph" data-editable="">Line 1<br>Line 2</p></div></div></div></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="bn-inline-content">Line 1<br>Line 2</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="bn-block-group" data-node-type="blockGroup"><div class="bn-block-outer" data-node-type="blockOuter" data-id="1"><div class="bn-block" data-node-type="blockContainer" data-id="1"><div class="bn-block-content" data-content-type="paragraph"><p class="bn-inline-content">Line 1<br>Line 2</p></div></div></div></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello World
|