@blocknote/xl-multi-column 0.24.2 → 0.25.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/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1741102175566,"assets":[{"name":"blocknote-xl-multi-column.cjs","size":20693},{"name":"blocknote-xl-multi-column.cjs.map","size":3430139}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote-xl-multi-column.cjs"],"names":["blocknote-xl-multi-column"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":364,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/de.ts","size":400,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/en.ts","size":378,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/es.ts","size":392,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":398,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/hr.ts","size":396,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":376,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":284,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":288,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":390,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":394,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":388,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ru.ts","size":370,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":340,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":274,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/i18n/dictionary.ts","size":189,"chunks":["a1ee98a"]},{"name":"./src/extensions/ColumnResize/ColumnResizeExtension.ts","size":8309,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Column.ts","size":2567,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/ColumnList.ts","size":1120,"chunks":["a1ee98a"]},{"name":"./src/blocks/Columns/index.ts","size":210,"chunks":["a1ee98a"]},{"name":"./src/blocks/schema.ts","size":425,"chunks":["a1ee98a"]},{"name":"./src/extensions/DropCursor/MultiColumnDropCursorPlugin.ts","size":12035,"chunks":["a1ee98a"]},{"name":"../../node_modules/react-icons/lib/iconContext.mjs","size":251,"chunks":["a1ee98a"]},{"name":"../../node_modules/react-icons/lib/iconBase.mjs","size":4014,"chunks":["a1ee98a"]},{"name":"../../node_modules/react-icons/tb/index.mjs","size":732,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getMultiColumnSlashMenuItems.tsx","size":2073,"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": "AGPL-3.0 OR PROPRIETARY",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.25.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"types",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"type": "module",
|
|
27
27
|
"source": "src/index.ts",
|
|
28
28
|
"types": "./types/src/index.d.ts",
|
|
29
|
-
"main": "./dist/blocknote-xl-multi-column.
|
|
29
|
+
"main": "./dist/blocknote-xl-multi-column.cjs",
|
|
30
30
|
"module": "./dist/blocknote-xl-multi-column.js",
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|
|
33
33
|
"types": "./types/src/index.d.ts",
|
|
34
34
|
"import": "./dist/blocknote-xl-multi-column.js",
|
|
35
|
-
"require": "./dist/blocknote-xl-multi-column.
|
|
35
|
+
"require": "./dist/blocknote-xl-multi-column.cjs"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"clean": "rimraf dist && rimraf types"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@blocknote/core": "^0.
|
|
49
|
-
"@blocknote/react": "^0.
|
|
48
|
+
"@blocknote/core": "^0.25.0",
|
|
49
|
+
"@blocknote/react": "^0.25.0",
|
|
50
50
|
"@tiptap/core": "^2.7.1",
|
|
51
51
|
"prosemirror-model": "^1.23.0",
|
|
52
52
|
"prosemirror-state": "^1.4.3",
|
|
53
53
|
"prosemirror-tables": "^1.3.7",
|
|
54
54
|
"prosemirror-transform": "^1.9.0",
|
|
55
|
-
"prosemirror-view": "^1.38.
|
|
55
|
+
"prosemirror-view": "^1.38.1",
|
|
56
56
|
"react-icons": "^5.2.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"access": "public",
|
|
81
81
|
"registry": "https://registry.npmjs.org/"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "2e7e03a8e9ccdb4a169c7436d48205e04021db97"
|
|
84
84
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(a,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@blocknote/core"),require("@tiptap/core"),require("prosemirror-state"),require("prosemirror-view"),require("prosemirror-transform"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","@blocknote/core","@tiptap/core","prosemirror-state","prosemirror-view","prosemirror-transform","react/jsx-runtime","react"],r):(a=typeof globalThis<"u"?globalThis:a||self,r(a["blocknote-xl-multi-column"]={},a.core$1,a.core,a.prosemirrorState,a.prosemirrorView,a.prosemirrorTransform,a.jsxRuntime,a.React))})(this,function(a,r,_,O,S,X,I,U){"use strict";var he=Object.defineProperty;var me=(a,r,_)=>r in a?he(a,r,{enumerable:!0,configurable:!0,writable:!0,value:_}):a[r]=_;var g=(a,r,_)=>me(a,typeof r!="symbol"?r+"":r,_);const k=(o=>o&&typeof o=="object"&&"default"in o?o:{default:o})(U),q=Object.freeze(Object.defineProperty({__proto__:null,ar:{slash_menu:{two_columns:{title:"عمودان",subtext:"عمودان جنبًا إلى جنب",aliases:["أعمدة","صف","تقسيم"],group:"الكتل الأساسية"},three_columns:{title:"ثلاثة أعمدة",subtext:"ثلاثة أعمدة جنبًا إلى جنب",aliases:["أعمدة","صف","تقسيم"],group:"الكتل الأساسية"}}},de:{slash_menu:{two_columns:{title:"Zwei Spalten",subtext:"Zwei Spalten nebeneinander",aliases:["Spalten","Reihe","teilen"],group:"Grundlegende blöcke"},three_columns:{title:"Drei Spalten",subtext:"Drei Spalten nebeneinander",aliases:["Spalten","Reihe","teilen"],group:"Grundlegende blöcke"}}},en:{slash_menu:{two_columns:{title:"Two Columns",subtext:"Two columns side by side",aliases:["columns","row","split"],group:"Basic blocks"},three_columns:{title:"Three Columns",subtext:"Three columns side by side",aliases:["columns","row","split"],group:"Basic blocks"}}},es:{slash_menu:{two_columns:{title:"Dos Columnas",subtext:"Dos columnas lado a lado",aliases:["columnas","fila","dividir"],group:"Bloques básicos"},three_columns:{title:"Tres Columnas",subtext:"Tres columnas lado a lado",aliases:["columnas","fila","dividir"],group:"Bloques básicos"}}},fr:{slash_menu:{two_columns:{title:"Deux Colonnes",subtext:"Deux colonnes côte à côte",aliases:["colonnes","rangée","partager"],group:"Blocs de base"},three_columns:{title:"Trois Colonnes",subtext:"Trois colonnes côte à côte",aliases:["colonnes","rangée","partager"],group:"Blocs de base"}}},hr:{slash_menu:{two_columns:{title:"Dva Stupca",subtext:"Dva stupca jedan pored drugog",aliases:["stupci","redak","podijeli"],group:"Osnovni blokovi"},three_columns:{title:"Tri Stupca",subtext:"Tri stupca jedan pored drugog",aliases:["stupci","redak","podijeli"],group:"Osnovni blokovi"}}},is:{slash_menu:{two_columns:{title:"Tvær Dálkar",subtext:"Tvær dálkar hlið við hlið",aliases:["dálkar","röð","skipta"],group:"Grunnblokkar"},three_columns:{title:"Þrír Dálkar",subtext:"Þrír dálkar hlið við hlið",aliases:["dálkar","röð","skipta"],group:"Grunnblokkar"}}},ja:{slash_menu:{two_columns:{title:"二列",subtext:"二列並んで",aliases:["列","行","分割"],group:"基本ブロック"},three_columns:{title:"三列",subtext:"三列並んで",aliases:["列","行","分割"],group:"基本ブロック"}}},ko:{slash_menu:{two_columns:{title:"두 열",subtext:"두 열 나란히",aliases:["열","행","분할"],group:"기본 블록"},three_columns:{title:"세 열",subtext:"세 열 나란히",aliases:["열","행","분할"],group:"기본 블록"}}},nl:{slash_menu:{two_columns:{title:"Twee Kolommen",subtext:"Twee kolommen naast elkaar",aliases:["kolommen","rij","verdelen"],group:"Basisblokken"},three_columns:{title:"Drie Kolommen",subtext:"Drie kolommen naast elkaar",aliases:["kolommen","rij","verdelen"],group:"Basisblokken"}}},pl:{slash_menu:{two_columns:{title:"Dwie Kolumny",subtext:"Dwie kolumny obok siebie",aliases:["kolumny","rząd","podzielić"],group:"Podstawowe bloki"},three_columns:{title:"Trzy Kolumny",subtext:"Trzy kolumny obok siebie",aliases:["kolumny","rząd","podzielić"],group:"Podstawowe bloki"}}},pt:{slash_menu:{two_columns:{title:"Duas Colunas",subtext:"Duas colunas lado a lado",aliases:["colunas","linha","dividir"],group:"Blocos básicos"},three_columns:{title:"Três Colunas",subtext:"Três colunas lado a lado",aliases:["colunas","linha","dividir"],group:"Blocos básicos"}}},ru:{slash_menu:{two_columns:{title:"Два Столбца",subtext:"Два столбца рядом",aliases:["столбцы","ряд","разделить"],group:"Базовые блоки"},three_columns:{title:"Три Столбца",subtext:"Три столбца рядом",aliases:["столбцы","ряд","разделить"],group:"Базовые блоки"}}},vi:{slash_menu:{two_columns:{title:"Hai Cột",subtext:"Hai cột cạnh nhau",aliases:["cột","hàng","chia"],group:"Khối cơ bản"},three_columns:{title:"Ba Cột",subtext:"Ba cột cạnh nhau",aliases:["cột","hàng","chia"],group:"Khối cơ bản"}}},zh:{slash_menu:{two_columns:{title:"两列",subtext:"两列并排",aliases:["列","行","分割"],group:"基础"},three_columns:{title:"三列",subtext:"三列并排",aliases:["列","行","分割"],group:"基础"}}}},Symbol.toStringTag,{value:"Module"}));function E(o){if(!o.dictionary.multi_column)throw new Error("Multi-column dictionary not found");return o.dictionary.multi_column}const y=new O.PluginKey("ColumnResizePlugin");class G{constructor(e,t){g(this,"editor");g(this,"view");g(this,"RESIZE_MARGIN_WIDTH_PX",20);g(this,"COLUMN_MIN_WIDTH_PERCENT",.5);g(this,"getColumnHoverOrDefaultState",e=>{if(!this.editor.isEditable)return{type:"default"};const t=e.target;if(!this.view.dom.contains(t))return{type:"default"};const n=t.closest(".bn-block-column");if(!n)return{type:"default"};const l=e.clientX,h=n.getBoundingClientRect(),u=l<h.left+this.RESIZE_MARGIN_WIDTH_PX?"left":l>h.right-this.RESIZE_MARGIN_WIDTH_PX?"right":"none",c=u==="left"?n.previousElementSibling:u==="right"?n.nextElementSibling:void 0;if(!c)return{type:"default"};const i=u==="left"?c:n,w=u==="left"?n:c,d=i.getAttribute("data-id"),s=w.getAttribute("data-id"),m=r.getNodeById(d,this.view.state.doc),f=r.getNodeById(s,this.view.state.doc);if(!m||!f||!m.posBeforeNode)throw new Error("Column not found");return{type:"hover",leftColumn:{element:i,id:d,...m},rightColumn:{element:w,id:s,...f}}});g(this,"mouseDownHandler",e=>{let t=this.getColumnHoverOrDefaultState(e);if(t.type==="default")return;e.preventDefault();const n=e.clientX,l=t.leftColumn.element.getBoundingClientRect().width,h=t.rightColumn.element.getBoundingClientRect().width,u=t.leftColumn.node.attrs.width,c=t.rightColumn.node.attrs.width;t={type:"resize",startPos:n,leftColumn:{...t.leftColumn,widthPx:l,widthPercent:u},rightColumn:{...t.rightColumn,widthPx:h,widthPercent:c}},this.view.dispatch(this.view.state.tr.setMeta(y,t)),this.editor.sideMenu.freezeMenu()});g(this,"mouseMoveHandler",e=>{var i,w;const t=y.getState(this.view.state);if(!t)return;if(t.type!=="resize"){const d=this.getColumnHoverOrDefaultState(e),s=t.type==="default"&&d.type==="default",m=t.type!=="default"&&d.type!=="default"&&t.leftColumn.id===d.leftColumn.id&&t.rightColumn.id===d.rightColumn.id;if(s||m||d.type==="hover"&&((w=(i=this.editor.sideMenu.view)==null?void 0:i.state)!=null&&w.show))return;this.view.dispatch(this.view.state.tr.setMeta(y,d));return}const l=(e.clientX-t.startPos)*t.leftColumn.widthPercent,h=(t.leftColumn.widthPx+l)/t.leftColumn.widthPx-1;let u=t.leftColumn.widthPercent+h,c=t.rightColumn.widthPercent-h;u<this.COLUMN_MIN_WIDTH_PERCENT?(c-=this.COLUMN_MIN_WIDTH_PERCENT-u,u=this.COLUMN_MIN_WIDTH_PERCENT):c<this.COLUMN_MIN_WIDTH_PERCENT&&(u-=this.COLUMN_MIN_WIDTH_PERCENT-c,c=this.COLUMN_MIN_WIDTH_PERCENT),this.view.dispatch(this.view.state.tr.setNodeAttribute(t.leftColumn.posBeforeNode,"width",u).setNodeAttribute(t.rightColumn.posBeforeNode,"width",c).setMeta("addToHistory",!1))});g(this,"mouseUpHandler",e=>{const t=y.getState(this.view.state);if(!t||t.type!=="resize")return;const n=this.getColumnHoverOrDefaultState(e);this.view.dispatch(this.view.state.tr.setMeta(y,n)),this.editor.sideMenu.unfreezeMenu()});this.editor=e,this.view=t,this.view.dom.addEventListener("mousedown",this.mouseDownHandler),document.body.addEventListener("mousemove",this.mouseMoveHandler),document.body.addEventListener("mouseup",this.mouseUpHandler)}destroy(){this.view.dom.removeEventListener("mousedown",this.mouseDownHandler),document.body.removeEventListener("mousemove",this.mouseMoveHandler),document.body.removeEventListener("mouseup",this.mouseUpHandler)}}const K=o=>new O.Plugin({key:y,props:{decorations:e=>{const t=y.getState(e);return!t||t.type==="default"?S.DecorationSet.empty:S.DecorationSet.create(e.doc,[S.Decoration.node(t.leftColumn.posBeforeNode,t.leftColumn.posBeforeNode+t.leftColumn.node.nodeSize,{style:"box-shadow: 4px 0 0 #ccc; cursor: col-resize"}),S.Decoration.node(t.rightColumn.posBeforeNode,t.rightColumn.posBeforeNode+t.rightColumn.node.nodeSize,{style:"cursor: col-resize"})])}},state:{init:()=>({type:"default"}),apply:(e,t)=>{const n=e.getMeta(y);return n===void 0?t:n}},view:e=>new G(o,e)}),F=o=>_.Extension.create({name:"columnResize",addProseMirrorPlugins(){return[K(o)]}}),Y=r.createStronglyTypedTiptapNode({name:"column",group:"bnBlock childContainer",content:"blockContainer+",priority:40,defining:!0,addAttributes(){return{width:{default:1,parseHTML:o=>{const e=o.getAttribute("data-width");if(e===null)return null;const t=parseFloat(e);return isFinite(t)?t:null},renderHTML:o=>({"data-width":o.width.toString(),style:`flex-grow: ${o.width};`})}}},parseHTML(){return[{tag:"div",getAttrs:o=>typeof o=="string"?!1:o.getAttribute("data-node-type")===this.name?{}:!1}]},renderHTML({HTMLAttributes:o}){const e=document.createElement("div");e.className="bn-block-column",e.setAttribute("data-node-type",this.name);for(const[t,n]of Object.entries(o))e.setAttribute(t,n);return{dom:e,contentDOM:e}},addExtensions(){return[F(this.options.editor)]}}),Z=r.createStronglyTypedTiptapNode({name:"columnList",group:"childContainer bnBlock blockGroupChild",content:"column column+",priority:40,defining:!0,parseHTML(){return[{tag:"div",getAttrs:o=>typeof o=="string"?!1:o.getAttribute("data-node-type")===this.name?{}:!1}]},renderHTML({HTMLAttributes:o}){const e=document.createElement("div");e.className="bn-block-column-list",e.setAttribute("data-node-type",this.name);for(const[t,n]of Object.entries(o))e.setAttribute(t,n);return e.style.display="flex",{dom:e,contentDOM:e}}}),x=r.createBlockSpecFromStronglyTypedTiptapNode(Y,{width:{default:1}}),N=r.createBlockSpecFromStronglyTypedTiptapNode(Z,{}),M=r.BlockNoteSchema.create({blockSpecs:{column:x,columnList:N}}),J=o=>r.BlockNoteSchema.create({blockSpecs:{...o.blockSpecs,column:x,columnList:N},inlineContentSpecs:o.inlineContentSpecs,styleSpecs:o.styleSpecs}),P=.1;function Q(o){return{left:o.clientX,top:o.clientY}}function $(o){const e=o.editor;return new O.Plugin({view(t){return new ee(t,o)},props:{handleDrop(t,n,l,h){const u=t.posAtCoords(Q(n));if(!u)throw new Error("Could not get event position");const c=L(t.state,u),i=r.getBlockInfo(c),d=t.nodeDOM(c.posBeforeNode).getBoundingClientRect();let s="regular";if(n.clientX<=d.left+d.width*P&&(s="left"),n.clientX>=d.right-d.width*P&&(s="right"),s==="regular")return!1;const m=r.nodeToBlock(l.content.child(0),e.schema.blockSchema,e.schema.inlineContentSchema,e.schema.styleSchema);if(i.blockNoteType==="column"){const f=t.state.doc.resolve(i.bnBlock.beforePos).node(),p=r.nodeToBlock(f,e.schema.blockSchema,e.schema.inlineContentSchema,e.schema.styleSchema);let b=0;p.children.forEach(C=>{b+=C.props.width});const v=b/p.children.length;if(v<.99||v>1.01){const C=1/v;p.children.forEach(D=>{D.props.width=D.props.width*C})}const V=p.children.findIndex(C=>C.id===i.bnBlock.node.attrs.id),de=p.children.map(C=>({...C,children:C.children.filter(D=>D.id!==m.id)})).filter(C=>C.children.length>0).toSpliced(s==="left"?V:V+1,0,{type:"column",children:[m],props:{},content:void 0,id:r.UniqueID.options.generateID()});e.removeBlocks([m]),e.updateBlock(p,{children:de})}else{const f=r.nodeToBlock(i.bnBlock.node,e.schema.blockSchema,e.schema.inlineContentSchema,e.schema.styleSchema);if(f.id===m.id)return;const p=s==="left"?[m,f]:[f,m];e.removeBlocks([m]),e.replaceBlocks([f],[{type:"columnList",children:p.map(b=>({type:"column",children:[b]}))}])}return!0}}})}class ee{constructor(e,t){g(this,"width");g(this,"color");g(this,"class");g(this,"cursorPos");g(this,"element",null);g(this,"timeout");g(this,"handlers");this.editorView=e,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(n=>{const l=h=>{this[n](h)};return e.dom.addEventListener(n,l,n==="drop"?!0:void 0),{name:n,handler:l}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t,e==="drop"?!0:void 0))}update(e,t){this.cursorPos!=null&&t.doc!==e.state.doc&&(this.cursorPos.pos>e.state.doc.content.size?this.setCursor(void 0):this.updateOverlay())}setCursor(e){var t,n;e===this.cursorPos||(e==null?void 0:e.pos)===((t=this.cursorPos)==null?void 0:t.pos)&&(e==null?void 0:e.position)===((n=this.cursorPos)==null?void 0:n.position)||(this.cursorPos=e,e?this.updateOverlay():(this.element.parentNode.removeChild(this.element),this.element=null))}updateOverlay(){if(!this.cursorPos)throw new Error("updateOverlay called with no cursor position");const e=this.editorView.state.doc.resolve(this.cursorPos.pos),t=!e.parent.inlineContent;let n;const l=this.editorView.dom,h=l.getBoundingClientRect(),u=h.width/l.offsetWidth,c=h.height/l.offsetHeight;if(t){const s=e.nodeBefore,m=e.nodeAfter;if(s||m)if(this.cursorPos.position==="left"||this.cursorPos.position==="right"){const f=this.editorView.nodeDOM(this.cursorPos.pos);if(!f)throw new Error("nodeDOM returned null in updateOverlay");const p=f.getBoundingClientRect(),b=this.width/2*c,v=this.cursorPos.position==="left"?p.left:p.right;n={left:v-b,right:v+b,top:p.top,bottom:p.bottom}}else{const f=this.editorView.nodeDOM(this.cursorPos.pos-(s?s.nodeSize:0));if(f){const p=f.getBoundingClientRect();let b=s?p.bottom:p.top;s&&m&&(b=(b+this.editorView.nodeDOM(this.cursorPos.pos).getBoundingClientRect().top)/2);const v=this.width/2*c;this.cursorPos.position==="regular"&&(n={left:p.left,right:p.right,top:b-v,bottom:b+v})}}}if(!n){const s=this.editorView.coordsAtPos(this.cursorPos.pos),m=this.width/2*u;n={left:s.left-m,right:s.left+m,top:s.top,bottom:s.bottom}}const i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-vertical",this.cursorPos.position!=="regular"),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let w,d;if(!i||i===document.body&&getComputedStyle(i).position==="static")w=-window.scrollX,d=-window.scrollY;else{const s=i.getBoundingClientRect(),m=s.width/i.offsetWidth,f=s.height/i.offsetHeight;w=s.left-i.scrollLeft*m,d=s.top-i.scrollTop*f}this.element.style.left=(n.left-w)/u+"px",this.element.style.top=(n.top-d)/c+"px",this.element.style.width=(n.right-n.left)/u+"px",this.element.style.height=(n.bottom-n.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(void 0),e)}dragover(e){if(!this.editorView.editable)return;const t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),l=n&&n.type.spec.disableDropCursor,h=typeof l=="function"?l(this.editorView,t,e):l;if(t&&!h){let u="regular",c=t.pos;const i=L(this.editorView.state,t),d=this.editorView.nodeDOM(i.posBeforeNode).getBoundingClientRect();if(e.clientX<=d.left+d.width*P&&(u="left",c=i.posBeforeNode),e.clientX>=d.right-d.width*P&&(u="right",c=i.posBeforeNode),u==="regular"&&this.editorView.dragging&&this.editorView.dragging.slice){const s=X.dropPoint(this.editorView.state.doc,c,this.editorView.dragging.slice);s!=null&&(c=s)}this.setCursor({pos:c,position:u}),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.setCursor(void 0)}dragleave(e){(e.target===this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(void 0)}}function L(o,e){const t=r.getNearestBlockPos(o.doc,e.pos);let n=o.doc.resolve(t.posBeforeNode);return n.parent.type.name==="column"&&(n=o.doc.resolve(n.before())),{posBeforeNode:n.pos,node:n.nodeAfter}}var R={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},j=k.default.createContext&&k.default.createContext(R),te=["attr","size","title"];function oe(o,e){if(o==null)return{};var t=ne(o,e),n,l;if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(o);for(l=0;l<h.length;l++)n=h[l],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(o,n)&&(t[n]=o[n])}return t}function ne(o,e){if(o==null)return{};var t={};for(var n in o)if(Object.prototype.hasOwnProperty.call(o,n)){if(e.indexOf(n)>=0)continue;t[n]=o[n]}return t}function T(){return T=Object.assign?Object.assign.bind():function(o){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n])}return o},T.apply(this,arguments)}function z(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(o);e&&(n=n.filter(function(l){return Object.getOwnPropertyDescriptor(o,l).enumerable})),t.push.apply(t,n)}return t}function B(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?z(Object(t),!0).forEach(function(n){ie(o,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):z(Object(t)).forEach(function(n){Object.defineProperty(o,n,Object.getOwnPropertyDescriptor(t,n))})}return o}function ie(o,e,t){return e=se(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function se(o){var e=re(o,"string");return typeof e=="symbol"?e:e+""}function re(o,e){if(typeof o!="object"||!o)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var n=t.call(o,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}function H(o){return o&&o.map((e,t)=>k.default.createElement(e.tag,B({key:t},e.attr),H(e.child)))}function W(o){return e=>k.default.createElement(le,T({attr:B({},o.attr)},e),H(o.child))}function le(o){var e=t=>{var{attr:n,size:l,title:h}=o,u=oe(o,te),c=l||t.size||"1em",i;return t.className&&(i=t.className),o.className&&(i=(i?i+" ":"")+o.className),k.default.createElement("svg",T({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,u,{className:i,style:B(B({color:o.color||t.color},t.style),o.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),h&&k.default.createElement("title",null,h),o.children)};return j!==void 0?k.default.createElement(j.Consumer,null,t=>e(t)):e(R)}function ce(o){return W({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm9 -1v18"},child:[]}]})(o)}function ae(o){return W({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm6 -1v18m6 -18v18"},child:[]}]})(o)}function A(o){return"column"in o.schema.blockSchema&&o.schema.blockSchema.columnList===M.blockSchema.columnList&&"column"in o.schema.blockSchema&&o.schema.blockSchema.column===M.blockSchema.column}function ue(o){const e=[];return A(o)&&e.push({...E(o).slash_menu.two_columns,icon:I.jsx(ce,{size:18}),onItemClick:()=>{r.insertOrUpdateBlock(o,{type:"columnList",children:[{type:"column",children:[{type:"paragraph"}]},{type:"column",children:[{type:"paragraph"}]}]})}},{...E(o).slash_menu.three_columns,icon:I.jsx(ae,{size:18}),onItemClick:()=>{r.insertOrUpdateBlock(o,{type:"columnList",children:[{type:"column",children:[{type:"paragraph"}]},{type:"column",children:[{type:"paragraph"}]},{type:"column",children:[{type:"paragraph"}]}]})}}),e}a.ColumnBlock=x,a.ColumnListBlock=N,a.checkMultiColumnBlocksInSchema=A,a.getMultiColumnDictionary=E,a.getMultiColumnSlashMenuItems=ue,a.locales=q,a.multiColumnDropCursor=$,a.multiColumnSchema=M,a.withMultiColumn=J,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
-
//# sourceMappingURL=blocknote-xl-multi-column.umd.cjs.map
|