@blocknote/core 0.14.2 → 0.14.4
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 +793 -463
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +4 -4
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html +1 -0
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html +1 -0
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html +1 -0
- package/src/api/exporters/html/htmlConversion.test.ts +140 -0
- package/src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts +31 -8
- package/src/editor/BlockNoteExtensions.ts +1 -0
- package/src/editor/editor.css +1 -1
- package/src/extensions/SideMenu/SideMenuPlugin.ts +1 -1
- package/src/i18n/locales/index.ts +2 -1
- package/src/i18n/locales/ru.ts +323 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/ru.d.ts +2 -0
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:.5em}[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:.5em}.bn-block-content[data-content-type=checkListItem]>div{display:flex}.bn-block-content[data-content-type=checkListItem]>div>div>input{margin:0;margin-inline-end:.5em;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;
|
|
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:.5em}[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:.5em}.bn-block-content[data-content-type=checkListItem]>div{display:flex}.bn-block-content[data-content-type=checkListItem]>div>div>input{margin:0;margin-inline-end:.5em;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;z-index:-1}.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":1720022379815,"assets":[{"name":"blocknote.umd.cjs","size":182010},{"name":"blocknote.umd.cjs.map","size":667946}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":6398,"chunks":["a1ee98a"]},{"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/ru.ts","size":7393,"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":3119,"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":622,"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":3480,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":4355,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":7365,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":7738,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":16932,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":15292,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/copyExtension.ts","size":2883,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":6248,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/acceptedMIMETypes.ts","size":91,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/handleFileInsertion.ts","size":1983,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/pasteExtension.ts","size":1244,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/fileDropExtension.ts","size":884,"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":4243,"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":2758,"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":23024,"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.14.
|
|
6
|
+
"version": "0.14.4",
|
|
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": "
|
|
119
|
+
"gitHead": "fe5ba74b5f2fb19dbd1a9238bd27a4e4e6851411"
|
|
120
120
|
}
|
package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="bn-inline-content">Nested Paragraph 1</p><p class="bn-inline-content">Nested Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 3</p><p class="bn-inline-content">Paragraph 2</p>
|
package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="bn-inline-content">Nested Paragraph 1</p><p class="bn-inline-content">Nested Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 3</p><p class="bn-inline-content">Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 1</p><p class="bn-inline-content">Nested Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 3</p>
|
package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="bn-inline-content">Nested Paragraph 1</p><p class="bn-inline-content">Nested Paragraph 2</p><p class="bn-inline-content">Nested Paragraph 3</p>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TextSelection } from "prosemirror-state";
|
|
1
2
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
3
|
import { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
|
|
3
4
|
|
|
@@ -101,3 +102,142 @@ describe("Test HTML conversion", () => {
|
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
104
|
});
|
|
105
|
+
|
|
106
|
+
// Fragments created from ProseMirror selections don't always conform to the
|
|
107
|
+
// schema. This is because ProseMirror preserves the full ancestry of selected
|
|
108
|
+
// nodes, but not the siblings of ancestor nodes. These tests are to verify that
|
|
109
|
+
// Fragments like this are exported to HTML properly, as they can't be created
|
|
110
|
+
// from Block objects like all the other test cases (Block object conversions
|
|
111
|
+
// always conform to the schema).
|
|
112
|
+
describe("Test ProseMirror fragment edge case conversion", () => {
|
|
113
|
+
let editor: BlockNoteEditor;
|
|
114
|
+
const div = document.createElement("div");
|
|
115
|
+
beforeEach(() => {
|
|
116
|
+
editor = BlockNoteEditor.create();
|
|
117
|
+
editor.mount(div);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
afterEach(() => {
|
|
121
|
+
editor.mount(undefined);
|
|
122
|
+
editor._tiptapEditor.destroy();
|
|
123
|
+
editor = undefined as any;
|
|
124
|
+
|
|
125
|
+
delete (window as Window & { __TEST_OPTIONS?: any }).__TEST_OPTIONS;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// When the selection starts in a nested block, the Fragment from it omits the
|
|
129
|
+
// `blockContent` node of the parent `blockContainer` if it's not also
|
|
130
|
+
// included in the selection. In the schema, `blockContainer` nodes should
|
|
131
|
+
// contain a single `blockContent` node, so this edge case needs to be tested.
|
|
132
|
+
describe("No block content", () => {
|
|
133
|
+
const blocks: PartialBlock[] = [
|
|
134
|
+
{
|
|
135
|
+
type: "paragraph",
|
|
136
|
+
content: "Paragraph 1",
|
|
137
|
+
children: [
|
|
138
|
+
{
|
|
139
|
+
type: "paragraph",
|
|
140
|
+
content: "Nested Paragraph 1",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: "paragraph",
|
|
144
|
+
content: "Nested Paragraph 2",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
type: "paragraph",
|
|
148
|
+
content: "Nested Paragraph 3",
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: "paragraph",
|
|
154
|
+
content: "Paragraph 2",
|
|
155
|
+
children: [
|
|
156
|
+
{
|
|
157
|
+
type: "paragraph",
|
|
158
|
+
content: "Nested Paragraph 1",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: "paragraph",
|
|
162
|
+
content: "Nested Paragraph 2",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: "paragraph",
|
|
166
|
+
content: "Nested Paragraph 3",
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
beforeEach(() => {
|
|
173
|
+
editor.replaceBlocks(editor.document, blocks);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("Selection within a block's children", () => {
|
|
177
|
+
// Selection starts and ends within the first block's children.
|
|
178
|
+
editor.prosemirrorView.dispatch(
|
|
179
|
+
editor._tiptapEditor.state.tr.setSelection(
|
|
180
|
+
TextSelection.create(editor._tiptapEditor.state.doc, 18, 80)
|
|
181
|
+
)
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const copiedFragment =
|
|
185
|
+
editor._tiptapEditor.state.selection.content().content;
|
|
186
|
+
|
|
187
|
+
const exporter = createExternalHTMLExporter(
|
|
188
|
+
editor._tiptapEditor.schema,
|
|
189
|
+
editor
|
|
190
|
+
);
|
|
191
|
+
const externalHTML = exporter.exportProseMirrorFragment(copiedFragment);
|
|
192
|
+
expect(externalHTML).toMatchFileSnapshot(
|
|
193
|
+
"./__snapshots_fragment_edge_cases__/" +
|
|
194
|
+
"selectionWithinBlockChildren.html"
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it("Selection leaves a block's children", () => {
|
|
199
|
+
// Selection starts and ends within the first block's children and ends
|
|
200
|
+
// outside, at a shallower nesting level in the second block.
|
|
201
|
+
editor.prosemirrorView.dispatch(
|
|
202
|
+
editor._tiptapEditor.state.tr.setSelection(
|
|
203
|
+
TextSelection.create(editor._tiptapEditor.state.doc, 18, 97)
|
|
204
|
+
)
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
const copiedFragment =
|
|
208
|
+
editor._tiptapEditor.state.selection.content().content;
|
|
209
|
+
|
|
210
|
+
const exporter = createExternalHTMLExporter(
|
|
211
|
+
editor._tiptapEditor.schema,
|
|
212
|
+
editor
|
|
213
|
+
);
|
|
214
|
+
const externalHTML = exporter.exportProseMirrorFragment(copiedFragment);
|
|
215
|
+
expect(externalHTML).toMatchFileSnapshot(
|
|
216
|
+
"./__snapshots_fragment_edge_cases__/" +
|
|
217
|
+
"selectionLeavesBlockChildren.html"
|
|
218
|
+
);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it("Selection spans multiple blocks' children", () => {
|
|
222
|
+
// Selection starts and ends within the first block's children and ends
|
|
223
|
+
// within the second block's children.
|
|
224
|
+
editor.prosemirrorView.dispatch(
|
|
225
|
+
editor._tiptapEditor.state.tr.setSelection(
|
|
226
|
+
TextSelection.create(editor._tiptapEditor.state.doc, 18, 163)
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
const copiedFragment =
|
|
231
|
+
editor._tiptapEditor.state.selection.content().content;
|
|
232
|
+
const exporter = createExternalHTMLExporter(
|
|
233
|
+
editor._tiptapEditor.schema,
|
|
234
|
+
editor
|
|
235
|
+
);
|
|
236
|
+
const externalHTML = exporter.exportProseMirrorFragment(copiedFragment);
|
|
237
|
+
expect(externalHTML).toMatchFileSnapshot(
|
|
238
|
+
"./__snapshots_fragment_edge_cases__/" +
|
|
239
|
+
"selectionSpansBlocksChildren.html"
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
});
|
|
@@ -41,11 +41,34 @@ export function simplifyBlocks(options: SimplifyBlocksOptions) {
|
|
|
41
41
|
for (let i = 0; i < numChildElements; i++) {
|
|
42
42
|
const blockOuter = tree.children[i] as HASTElement;
|
|
43
43
|
const blockContainer = blockOuter.children[0] as HASTElement;
|
|
44
|
-
const blockContent = blockContainer.children
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const blockContent = blockContainer.children.find((child) => {
|
|
45
|
+
const properties = (child as HASTElement).properties;
|
|
46
|
+
const classNames = properties?.["className"] as string[] | undefined;
|
|
47
|
+
|
|
48
|
+
return classNames?.includes("bn-block-content");
|
|
49
|
+
}) as HASTElement | undefined;
|
|
50
|
+
const blockGroup = blockContainer.children.find((child) => {
|
|
51
|
+
const properties = (child as HASTElement).properties;
|
|
52
|
+
const classNames = properties?.["className"] as string[] | undefined;
|
|
53
|
+
|
|
54
|
+
return classNames?.includes("bn-block-group");
|
|
55
|
+
}) as HASTElement | undefined;
|
|
56
|
+
|
|
57
|
+
// When the selection starts in a nested block, the Fragment from it omits
|
|
58
|
+
// the `blockContent` node of the parent `blockContainer` if it's not also
|
|
59
|
+
// included in the selection. This is because ProseMirror preserves the
|
|
60
|
+
// nesting hierarchy of the nested nodes, even if their ancestors aren't
|
|
61
|
+
// fully selected. In this case, we just lift the child `blockContainer`
|
|
62
|
+
// nodes up.
|
|
63
|
+
// NOTE: This only happens for the first `blockContainer`, since to get to
|
|
64
|
+
// any nested blocks later in the document, the selection must also
|
|
65
|
+
// include their parents.
|
|
66
|
+
if (!blockContent) {
|
|
67
|
+
tree.children.splice(i, 1, ...blockGroup!.children);
|
|
68
|
+
simplifyBlocksHelper(tree);
|
|
69
|
+
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
49
72
|
|
|
50
73
|
const isListItemBlock = listItemBlockTypes.has(
|
|
51
74
|
blockContent.properties!["dataContentType"] as string
|
|
@@ -60,7 +83,7 @@ export function simplifyBlocks(options: SimplifyBlocksOptions) {
|
|
|
60
83
|
: null;
|
|
61
84
|
|
|
62
85
|
// Plugin runs recursively to process nested blocks.
|
|
63
|
-
if (blockGroup
|
|
86
|
+
if (blockGroup) {
|
|
64
87
|
simplifyBlocksHelper(blockGroup);
|
|
65
88
|
}
|
|
66
89
|
|
|
@@ -101,13 +124,13 @@ export function simplifyBlocks(options: SimplifyBlocksOptions) {
|
|
|
101
124
|
listItemElement.children.push(...blockContent.children);
|
|
102
125
|
// Nested blocks have already been processed in the recursive function call, so the resulting elements are
|
|
103
126
|
// also added to the active list.
|
|
104
|
-
if (blockGroup
|
|
127
|
+
if (blockGroup) {
|
|
105
128
|
listItemElement.children.push(...blockGroup.children);
|
|
106
129
|
}
|
|
107
130
|
|
|
108
131
|
// Adds the list item representing the block to the active list.
|
|
109
132
|
activeList.children.push(listItemElement);
|
|
110
|
-
} else if (blockGroup
|
|
133
|
+
} else if (blockGroup) {
|
|
111
134
|
// Lifts all children out of the current block, as only list items should allow nesting.
|
|
112
135
|
tree.children.splice(i + 1, 0, ...blockGroup.children);
|
|
113
136
|
// Replaces the block with only the content inside it.
|
package/src/editor/editor.css
CHANGED
|
@@ -158,7 +158,7 @@ function unsetDragImage(rootEl: Document | ShadowRoot) {
|
|
|
158
158
|
if (rootEl instanceof ShadowRoot) {
|
|
159
159
|
rootEl.removeChild(dragImageElement);
|
|
160
160
|
} else {
|
|
161
|
-
rootEl.body.
|
|
161
|
+
rootEl.body.removeChild(dragImageElement);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
dragImageElement = undefined;
|