@limetech/lime-elements 40.2.1 → 40.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +105 -2
- package/dist/cjs/limel-table.cjs.entry.js +19 -5
- package/dist/collection/components/table/table.js +19 -5
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/table-paste-plugin.js +103 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/table-plugin.js +4 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.css +11 -0
- package/dist/esm/limel-prosemirror-adapter.entry.js +105 -2
- package/dist/esm/limel-table.entry.js +19 -5
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-5e432a44.entry.js → p-3ac35da4.entry.js} +1 -1
- package/dist/lime-elements/{p-d3d71a68.entry.js → p-6c826c25.entry.js} +1 -1
- package/dist/types/components/table/table.d.ts +2 -0
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/table-paste-plugin.d.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [40.2.3](https://github.com/Lundalogik/lime-elements/compare/v40.2.2...v40.2.3) (2026-09-14)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* **table:** skip prop updates while the table is being rebuilt ([b8f8731](https://github.com/Lundalogik/lime-elements/commit/b8f8731fc4547052ab825978457051d96dfff018))
|
|
7
|
+
|
|
8
|
+
## [40.2.2](https://github.com/Lundalogik/lime-elements/compare/v40.2.1...v40.2.2) (2026-09-09)
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
* **text-editor:** detect table pastes with pastedCells and add them as rows ([9655f0f](https://github.com/Lundalogik/lime-elements/commit/9655f0fa4380613f8d870473761039747e7579de))
|
|
14
|
+
* **text-editor:** extend table paste protection to row slices and cross-table selections ([ae90a00](https://github.com/Lundalogik/lime-elements/commit/ae90a009adabff0531a67eb25b275c648aa24ab4))
|
|
15
|
+
* **text-editor:** give tables visible borders while editing ([bf30f3d](https://github.com/Lundalogik/lime-elements/commit/bf30f3d625c5cbb185cd5f77c2f16bf1d7ca0165))
|
|
16
|
+
* **text-editor:** prevent content loss when pasting tables into cells ([29e0faf](https://github.com/Lundalogik/lime-elements/commit/29e0faf927c1557646d325dec169df3a19d6ccbc))
|
|
17
|
+
* **text-editor:** read pasted table slices without prosemirror-tables internals ([6151c1c](https://github.com/Lundalogik/lime-elements/commit/6151c1c64bab2a3965062d58576b518747ca7c2f))
|
|
18
|
+
|
|
1
19
|
## [40.2.1](https://github.com/Lundalogik/lime-elements/compare/v40.2.0...v40.2.1) (2026-09-09)
|
|
2
20
|
|
|
3
21
|
### Bug Fixes
|
|
@@ -27812,9 +27812,112 @@ function tableEditing({ allowTableNodeSelection = false } = {}) {
|
|
|
27812
27812
|
});
|
|
27813
27813
|
}
|
|
27814
27814
|
|
|
27815
|
+
const createTablePastePlugin = () => {
|
|
27816
|
+
return new Plugin({
|
|
27817
|
+
key: new PluginKey('tablePastePlugin'),
|
|
27818
|
+
props: {
|
|
27819
|
+
handlePaste: (view, _event, slice) => {
|
|
27820
|
+
return handleTablePaste(view, slice);
|
|
27821
|
+
},
|
|
27822
|
+
},
|
|
27823
|
+
});
|
|
27824
|
+
};
|
|
27825
|
+
// prosemirror-tables pastes a cell grid over the existing cells. Unless the
|
|
27826
|
+
// user selected cells explicitly, pasted cells become rows of the table (or
|
|
27827
|
+
// a new table) instead.
|
|
27828
|
+
const handleTablePaste = (view, slice) => {
|
|
27829
|
+
const { state } = view;
|
|
27830
|
+
if (state.selection instanceof CellSelection || !isInTable(state)) {
|
|
27831
|
+
return false;
|
|
27832
|
+
}
|
|
27833
|
+
const rows = pastedRows(slice, state.schema);
|
|
27834
|
+
if (!rows && !containsTableAmongBlocks(slice)) {
|
|
27835
|
+
return false;
|
|
27836
|
+
}
|
|
27837
|
+
const tr = state.tr.deleteSelection();
|
|
27838
|
+
const $cell = cellAround(tr.selection.$head);
|
|
27839
|
+
if (rows) {
|
|
27840
|
+
insertRows(tr, $cell, rows);
|
|
27841
|
+
}
|
|
27842
|
+
else {
|
|
27843
|
+
insertBlocks(tr, $cell, slice.content);
|
|
27844
|
+
}
|
|
27845
|
+
view.dispatch(tr.scrollIntoView());
|
|
27846
|
+
return true;
|
|
27847
|
+
};
|
|
27848
|
+
const insertRows = (tr, $cell, rows) => {
|
|
27849
|
+
const table = tableNodeTypes(tr.doc.type.schema).table.create(null, rows);
|
|
27850
|
+
if ($cell && rowsFitBelow($cell, TableMap.get(table).width)) {
|
|
27851
|
+
insertAt(tr, $cell.after(), rows);
|
|
27852
|
+
return;
|
|
27853
|
+
}
|
|
27854
|
+
insertBlocks(tr, $cell, Fragment.from(table));
|
|
27855
|
+
};
|
|
27856
|
+
const insertBlocks = (tr, $cell, blocks) => {
|
|
27857
|
+
if ($cell) {
|
|
27858
|
+
insertAt(tr, $cell.after(-1), blocks);
|
|
27859
|
+
return;
|
|
27860
|
+
}
|
|
27861
|
+
tr.replaceSelection(new Slice(blocks, 0, 0));
|
|
27862
|
+
};
|
|
27863
|
+
const insertAt = (tr, pos, content) => {
|
|
27864
|
+
const step = tr.steps.length;
|
|
27865
|
+
tr.insert(pos, content);
|
|
27866
|
+
const end = tr.mapping.slice(step).mapResult(pos, 1).pos;
|
|
27867
|
+
tr.setSelection(Selection.near(tr.doc.resolve(end), -1));
|
|
27868
|
+
};
|
|
27869
|
+
// A new row would split any cell spanning the boundary below the caret's row.
|
|
27870
|
+
const rowsFitBelow = ($cell, width) => {
|
|
27871
|
+
const map = TableMap.get($cell.node(-1));
|
|
27872
|
+
if (width !== map.width) {
|
|
27873
|
+
return false;
|
|
27874
|
+
}
|
|
27875
|
+
const boundary = map.findCell($cell.pos - $cell.start(-1)).top + 1;
|
|
27876
|
+
if (boundary >= map.height) {
|
|
27877
|
+
return true;
|
|
27878
|
+
}
|
|
27879
|
+
for (let col = 0; col < map.width; col++) {
|
|
27880
|
+
const above = map.map[(boundary - 1) * map.width + col];
|
|
27881
|
+
const below = map.map[boundary * map.width + col];
|
|
27882
|
+
if (above === below) {
|
|
27883
|
+
return false;
|
|
27884
|
+
}
|
|
27885
|
+
}
|
|
27886
|
+
return true;
|
|
27887
|
+
};
|
|
27888
|
+
// Reads the slice the way prosemirror-tables does: strip the wrappers a copy
|
|
27889
|
+
// from inside a table leaves around the content, then accept rows or cells.
|
|
27890
|
+
const pastedRows = (slice, schema) => {
|
|
27891
|
+
var _a;
|
|
27892
|
+
let { content, openStart, openEnd } = slice;
|
|
27893
|
+
while (content.childCount === 1 &&
|
|
27894
|
+
((openStart > 0 && openEnd > 0) ||
|
|
27895
|
+
content.firstChild.type.spec.tableRole === 'table')) {
|
|
27896
|
+
openStart--;
|
|
27897
|
+
openEnd--;
|
|
27898
|
+
content = content.firstChild.content;
|
|
27899
|
+
}
|
|
27900
|
+
const role = (_a = content.firstChild) === null || _a === void 0 ? void 0 : _a.type.spec.tableRole;
|
|
27901
|
+
if (role === 'row') {
|
|
27902
|
+
return content;
|
|
27903
|
+
}
|
|
27904
|
+
if (role === 'cell' || role === 'header_cell') {
|
|
27905
|
+
return Fragment.from(tableNodeTypes(schema).row.create(null, content));
|
|
27906
|
+
}
|
|
27907
|
+
return null;
|
|
27908
|
+
};
|
|
27909
|
+
const containsTableAmongBlocks = (slice) => {
|
|
27910
|
+
if (slice.content.childCount < 2) {
|
|
27911
|
+
return false;
|
|
27912
|
+
}
|
|
27913
|
+
return slice.content.content.some((block) => block.type.spec.tableRole === 'table');
|
|
27914
|
+
};
|
|
27915
|
+
|
|
27815
27916
|
const getTableEditingPlugins = (tablesEnabled) => {
|
|
27816
27917
|
if (tablesEnabled) {
|
|
27817
|
-
|
|
27918
|
+
// The paste plugin must precede tableEditing(), whose own
|
|
27919
|
+
// handlePaste would otherwise consume table pastes first.
|
|
27920
|
+
return [createTablePastePlugin(), tableEditing()];
|
|
27818
27921
|
}
|
|
27819
27922
|
return [];
|
|
27820
27923
|
};
|
|
@@ -28047,7 +28150,7 @@ function areFrequencyMapsEqual(map1, map2) {
|
|
|
28047
28150
|
return true;
|
|
28048
28151
|
}
|
|
28049
28152
|
|
|
28050
|
-
const prosemirrorAdapterCss = () => `@charset "UTF-8";blockquote{position:relative;max-width:100%;margin:0.75rem 0;padding:0.5rem;border-left:0.25rem solid rgb(var(--contrast-500));background-color:rgb(var(--contrast-200))}blockquote:before,blockquote:after{position:absolute;line-height:0;font-size:2rem;opacity:0.4}blockquote:before{content:"“";left:-0.5rem;top:0.5rem}blockquote:after{content:"”";right:-0.25rem;bottom:-0.25rem}blockquote blockquote{padding-top:0;padding-right:0;padding-bottom:0;padding-left:0.25rem;border-color:rgb(var(--contrast-700));border-left-width:1px}blockquote blockquote:before,blockquote blockquote:after{display:none}blockquote:has(>blockquote){padding-left:0.25rem;padding-bottom:0}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:var(--limel-theme-default-font-size);word-break:break-word}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:last-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:var(--limel-theme-default-font-size);margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:var(--limel-theme-default-font-size)}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:inherit}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}ul{list-style:none}ul>li{margin-left:0.75rem}ul>li:before{content:"";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{position:relative;margin-bottom:0.25rem}pre,pre p,code{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:0.75rem}pre{max-width:100%;white-space:pre-wrap;word-wrap:break-word}code{letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));tab-size:4;hyphens:none;display:inline;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0}:host(limel-markdown:not(.no-table-styles)) tbody{border:1px solid rgb(var(--contrast-400));border-radius:0.25rem}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:var(--limel-theme-default-font-size)}:host(limel-markdown:not(.no-table-styles)) th p,:host(limel-markdown:not(.no-table-styles)) th li,:host(limel-markdown:not(.no-table-styles)) th a,:host(limel-markdown:not(.no-table-styles)) td p,:host(limel-markdown:not(.no-table-styles)) td li,:host(limel-markdown:not(.no-table-styles)) td a{word-break:normal;overflow-wrap:normal}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}table{display:block;box-sizing:border-box;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}kbd{display:inline-block;font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-weight:600;color:rgb(var(--contrast-1100));white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;border-radius:0.125rem;border-style:solid;border-color:rgb(var(--contrast-500));border-width:0 1px 0.1875rem 1px;padding:0.0625rem 0.375rem;margin:0 0.25rem;background-color:rgb(var(--contrast-200));box-shadow:var(--button-shadow-normal), 0 0.625rem 0.375rem -0.5rem rgb(var(--color-black), 0.02), 0 0.025rem 0.5rem 0 rgb(var(--contrast-100)) inset}img{max-width:100%;border-radius:0.25rem}.image-wrapper{display:inline-flex;position:relative}.image-wrapper limel-linear-progress{position:absolute;inset:0.25rem auto auto 0.25rem;width:calc(100% - 0.5rem)}.image-wrapper img{transition:opacity 0.2s ease, scale 0.6s ease}.image-wrapper.state-failed,.image-wrapper.state-loading{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%208%208'%20style='fill-rule:evenodd;'%3E%3Cpath%20fill='rgba(186,186,192,0.16)'%20d='M0%200h4v4H0zM4%204h4v4H4z'/%3E%3C/svg%3E");background-size:0.5rem}.image-wrapper.state-failed img,.image-wrapper.state-loading img{opacity:0.3;scale:0.98}.image-wrapper::before{pointer-events:none;content:"";display:block;position:absolute;inset:0;border-radius:0.25rem;transition:border-color 0.4s ease, opacity 0.2s ease, box-shadow 0.6s ease;border:1px dashed transparent;opacity:0.2}.image-wrapper.state-failed img{filter:grayscale(0.8)}.image-wrapper.state-failed:before{opacity:0.8;box-shadow:var(--shadow-error-state)}.image-wrapper:hover::before{opacity:0.8;box-shadow:var(--shadow-depth-8)}.image-wrapper:has(.resize-handle[aria-grabbed=true])::before{border-color:var(--lime-primary-color, var(--limel-theme-primary-color));opacity:0.8;box-shadow:var(--shadow-depth-16), var(--shadow-depth-8)}.resize-handle{transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:rgb(var(--contrast-900));box-shadow:var(--button-shadow-normal)}.resize-handle:hover,.resize-handle:focus,.resize-handle:focus-visible{will-change:color, background-color, box-shadow, transform}.resize-handle:hover,.resize-handle:focus-visible{transform:translate3d(0, -0.04rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}.resize-handle:active{--limel-clickable-transform-timing-function:cubic-bezier( 0.83, -0.15, 0.49, 1.16 );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}.resize-handle:hover,.resize-handle:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}.resize-handle:focus{outline:none}.resize-handle:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.resize-handle{cursor:nwse-resize;position:absolute;display:flex;align-items:center;justify-content:center;width:0.5rem;height:0.5rem;border-radius:50%}.resize-handle.top-left{left:-0.25rem;top:-0.25rem;translate:-50%, -50%}.resize-handle.bottom-right{right:-0.25rem;bottom:-0.25rem;translate:50%, 50%}.resize-handle{opacity:0.6}.resize-wrapper:has(.resize-handle[aria-grabbed=true]) .resize-handle,.resize-wrapper:hover .resize-handle,.resize-handle:hover,.resize-handle:focus-visible{opacity:1}.resize-handle[aria-grabbed=true],.resize-handle:hover,.resize-handle:focus-visible{opacity:1;background-color:var(--lime-primary-color, var(--limel-theme-primary-color))}.resize-handle:hover,.resize-handle[aria-grabbed=true]{scale:1.4}.resize-handle:hover:before,.resize-handle[aria-grabbed=true]:before{background-color:rgb(var(--color-white))}.resize-handle:before{content:"";display:block;position:absolute;inset:0;margin:auto;border-radius:50%;width:0.25rem;height:0.25rem;background-color:rgb(var(--contrast-100))}:host(limel-prosemirror-adapter){display:flex;flex-direction:column}:host(limel-prosemirror-adapter) .toolbar{order:1}:host(limel-prosemirror-adapter) div#editor{order:2;height:100%;flex-grow:1}:host(limel-prosemirror-adapter) div[contenteditable=true]{height:100%}*{box-sizing:border-box}:host(limel-prosemirror-adapter:hover) .toolbar,:host(limel-prosemirror-adapter:focus-within) .toolbar{will-change:grid-template-rows}:host(limel-prosemirror-adapter:hover) limel-action-bar,:host(limel-prosemirror-adapter:focus-within) limel-action-bar{will-change:opacity, padding}.ProseMirror-menubar-wrapper{display:grid;grid-template-rows:auto 1fr}.ProseMirror-textblock-dropdown{min-width:3em}.ProseMirror-tooltip .ProseMirror-menu{width:-webkit-fit-content;width:fit-content;white-space:pre}.toolbar{--action-bar-border-radius:0.25rem;border-radius:var(--action-bar-border-radius);flex-shrink:0;position:sticky;z-index:1;top:0;width:100%;display:grid;grid-template-rows:var(--limel-prosemirror-adapter-toolbar-grid-template-rows);transition-property:grid-template-rows;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);background-color:rgba(var(--contrast-200), 0.5);backdrop-filter:blur(0.5rem);-webkit-backdrop-filter:blur(0.5rem)}limel-action-bar{min-width:0;transition-property:padding, opacity;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);opacity:var(--limel-prosemirror-adapter-toolbar-opacity);padding:var(--limel-prosemirror-adapter-action-bar-padding-top-bottom, 0.125rem) 0.25rem;background-color:transparent;overflow:hidden}.ProseMirror{position:relative;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:"liga" 0;padding:var(--limel-text-editor-padding)}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror:focus-visible{outline:none}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror-selectednode{outline:0.125rem solid rgb(var(--color-sky-light))}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";position:absolute;left:-2rem;right:-0.125rem;top:-0.125rem;bottom:-0.125rem;border:0.125rem solid rgb(var(--color-sky-light));pointer-events:none}img.ProseMirror-separator{display:inline !important;border:none !important;margin:0 !important}limel-portal{width:25rem}`;
|
|
28153
|
+
const prosemirrorAdapterCss = () => `@charset "UTF-8";blockquote{position:relative;max-width:100%;margin:0.75rem 0;padding:0.5rem;border-left:0.25rem solid rgb(var(--contrast-500));background-color:rgb(var(--contrast-200))}blockquote:before,blockquote:after{position:absolute;line-height:0;font-size:2rem;opacity:0.4}blockquote:before{content:"“";left:-0.5rem;top:0.5rem}blockquote:after{content:"”";right:-0.25rem;bottom:-0.25rem}blockquote blockquote{padding-top:0;padding-right:0;padding-bottom:0;padding-left:0.25rem;border-color:rgb(var(--contrast-700));border-left-width:1px}blockquote blockquote:before,blockquote blockquote:after{display:none}blockquote:has(>blockquote){padding-left:0.25rem;padding-bottom:0}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:var(--limel-theme-default-font-size);word-break:break-word}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:last-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:var(--limel-theme-default-font-size);margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:var(--limel-theme-default-font-size)}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:inherit}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}ul{list-style:none}ul>li{margin-left:0.75rem}ul>li:before{content:"";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{position:relative;margin-bottom:0.25rem}pre,pre p,code{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:0.75rem}pre{max-width:100%;white-space:pre-wrap;word-wrap:break-word}code{letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));tab-size:4;hyphens:none;display:inline;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0}:host(limel-markdown:not(.no-table-styles)) tbody{border:1px solid rgb(var(--contrast-400));border-radius:0.25rem}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:var(--limel-theme-default-font-size)}:host(limel-markdown:not(.no-table-styles)) th p,:host(limel-markdown:not(.no-table-styles)) th li,:host(limel-markdown:not(.no-table-styles)) th a,:host(limel-markdown:not(.no-table-styles)) td p,:host(limel-markdown:not(.no-table-styles)) td li,:host(limel-markdown:not(.no-table-styles)) td a{word-break:normal;overflow-wrap:normal}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}table{display:block;box-sizing:border-box;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}kbd{display:inline-block;font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-weight:600;color:rgb(var(--contrast-1100));white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;border-radius:0.125rem;border-style:solid;border-color:rgb(var(--contrast-500));border-width:0 1px 0.1875rem 1px;padding:0.0625rem 0.375rem;margin:0 0.25rem;background-color:rgb(var(--contrast-200));box-shadow:var(--button-shadow-normal), 0 0.625rem 0.375rem -0.5rem rgb(var(--color-black), 0.02), 0 0.025rem 0.5rem 0 rgb(var(--contrast-100)) inset}img{max-width:100%;border-radius:0.25rem}.image-wrapper{display:inline-flex;position:relative}.image-wrapper limel-linear-progress{position:absolute;inset:0.25rem auto auto 0.25rem;width:calc(100% - 0.5rem)}.image-wrapper img{transition:opacity 0.2s ease, scale 0.6s ease}.image-wrapper.state-failed,.image-wrapper.state-loading{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%208%208'%20style='fill-rule:evenodd;'%3E%3Cpath%20fill='rgba(186,186,192,0.16)'%20d='M0%200h4v4H0zM4%204h4v4H4z'/%3E%3C/svg%3E");background-size:0.5rem}.image-wrapper.state-failed img,.image-wrapper.state-loading img{opacity:0.3;scale:0.98}.image-wrapper::before{pointer-events:none;content:"";display:block;position:absolute;inset:0;border-radius:0.25rem;transition:border-color 0.4s ease, opacity 0.2s ease, box-shadow 0.6s ease;border:1px dashed transparent;opacity:0.2}.image-wrapper.state-failed img{filter:grayscale(0.8)}.image-wrapper.state-failed:before{opacity:0.8;box-shadow:var(--shadow-error-state)}.image-wrapper:hover::before{opacity:0.8;box-shadow:var(--shadow-depth-8)}.image-wrapper:has(.resize-handle[aria-grabbed=true])::before{border-color:var(--lime-primary-color, var(--limel-theme-primary-color));opacity:0.8;box-shadow:var(--shadow-depth-16), var(--shadow-depth-8)}.resize-handle{transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:rgb(var(--contrast-900));box-shadow:var(--button-shadow-normal)}.resize-handle:hover,.resize-handle:focus,.resize-handle:focus-visible{will-change:color, background-color, box-shadow, transform}.resize-handle:hover,.resize-handle:focus-visible{transform:translate3d(0, -0.04rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}.resize-handle:active{--limel-clickable-transform-timing-function:cubic-bezier( 0.83, -0.15, 0.49, 1.16 );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}.resize-handle:hover,.resize-handle:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}.resize-handle:focus{outline:none}.resize-handle:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.resize-handle{cursor:nwse-resize;position:absolute;display:flex;align-items:center;justify-content:center;width:0.5rem;height:0.5rem;border-radius:50%}.resize-handle.top-left{left:-0.25rem;top:-0.25rem;translate:-50%, -50%}.resize-handle.bottom-right{right:-0.25rem;bottom:-0.25rem;translate:50%, 50%}.resize-handle{opacity:0.6}.resize-wrapper:has(.resize-handle[aria-grabbed=true]) .resize-handle,.resize-wrapper:hover .resize-handle,.resize-handle:hover,.resize-handle:focus-visible{opacity:1}.resize-handle[aria-grabbed=true],.resize-handle:hover,.resize-handle:focus-visible{opacity:1;background-color:var(--lime-primary-color, var(--limel-theme-primary-color))}.resize-handle:hover,.resize-handle[aria-grabbed=true]{scale:1.4}.resize-handle:hover:before,.resize-handle[aria-grabbed=true]:before{background-color:rgb(var(--color-white))}.resize-handle:before{content:"";display:block;position:absolute;inset:0;margin:auto;border-radius:50%;width:0.25rem;height:0.25rem;background-color:rgb(var(--contrast-100))}:host(limel-prosemirror-adapter){display:flex;flex-direction:column}:host(limel-prosemirror-adapter) table{border-collapse:collapse;margin:0.75rem 0}:host(limel-prosemirror-adapter) th,:host(limel-prosemirror-adapter) td{border:1px solid rgb(var(--contrast-400));padding:0.25rem 0.375rem;text-align:left;vertical-align:top}:host(limel-prosemirror-adapter) .toolbar{order:1}:host(limel-prosemirror-adapter) div#editor{order:2;height:100%;flex-grow:1}:host(limel-prosemirror-adapter) div[contenteditable=true]{height:100%}*{box-sizing:border-box}:host(limel-prosemirror-adapter:hover) .toolbar,:host(limel-prosemirror-adapter:focus-within) .toolbar{will-change:grid-template-rows}:host(limel-prosemirror-adapter:hover) limel-action-bar,:host(limel-prosemirror-adapter:focus-within) limel-action-bar{will-change:opacity, padding}.ProseMirror-menubar-wrapper{display:grid;grid-template-rows:auto 1fr}.ProseMirror-textblock-dropdown{min-width:3em}.ProseMirror-tooltip .ProseMirror-menu{width:-webkit-fit-content;width:fit-content;white-space:pre}.toolbar{--action-bar-border-radius:0.25rem;border-radius:var(--action-bar-border-radius);flex-shrink:0;position:sticky;z-index:1;top:0;width:100%;display:grid;grid-template-rows:var(--limel-prosemirror-adapter-toolbar-grid-template-rows);transition-property:grid-template-rows;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);background-color:rgba(var(--contrast-200), 0.5);backdrop-filter:blur(0.5rem);-webkit-backdrop-filter:blur(0.5rem)}limel-action-bar{min-width:0;transition-property:padding, opacity;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);opacity:var(--limel-prosemirror-adapter-toolbar-opacity);padding:var(--limel-prosemirror-adapter-action-bar-padding-top-bottom, 0.125rem) 0.25rem;background-color:transparent;overflow:hidden}.ProseMirror{position:relative;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:"liga" 0;padding:var(--limel-text-editor-padding)}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror:focus-visible{outline:none}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror-selectednode{outline:0.125rem solid rgb(var(--color-sky-light))}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";position:absolute;left:-2rem;right:-0.125rem;top:-0.125rem;bottom:-0.125rem;border:0.125rem solid rgb(var(--color-sky-light));pointer-events:none}img.ProseMirror-separator{display:inline !important;border:none !important;margin:0 !important}limel-portal{width:25rem}`;
|
|
28051
28154
|
|
|
28052
28155
|
const DEBOUNCE_TIMEOUT = 300;
|
|
28053
28156
|
const ProsemirrorAdapter = class {
|
|
@@ -30752,6 +30752,7 @@ const Table = class {
|
|
|
30752
30752
|
*/
|
|
30753
30753
|
this.paginationLocation = 'bottom';
|
|
30754
30754
|
this.initialized = false;
|
|
30755
|
+
this.pendingColumnRefresh = false;
|
|
30755
30756
|
this.destroyed = false;
|
|
30756
30757
|
this.shouldSort = false;
|
|
30757
30758
|
this.hasWarnedOnConflictingMovableAndSortable = false;
|
|
@@ -30840,6 +30841,7 @@ const Table = class {
|
|
|
30840
30841
|
var _a;
|
|
30841
30842
|
this.destroyed = true;
|
|
30842
30843
|
this.initialized = false;
|
|
30844
|
+
this.pendingColumnRefresh = false;
|
|
30843
30845
|
(_a = this.rowDragManager) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
30844
30846
|
this.rowDragManager = null;
|
|
30845
30847
|
if (this.resizeObserver) {
|
|
@@ -30907,7 +30909,8 @@ const Table = class {
|
|
|
30907
30909
|
});
|
|
30908
30910
|
}
|
|
30909
30911
|
updateColumns(newColumns, oldColumns) {
|
|
30910
|
-
if (!this.tabulator) {
|
|
30912
|
+
if (!this.tabulator || !this.initialized) {
|
|
30913
|
+
this.pendingColumnRefresh = true;
|
|
30911
30914
|
return;
|
|
30912
30915
|
}
|
|
30913
30916
|
if (this.areSameColumns(newColumns, oldColumns)) {
|
|
@@ -30924,7 +30927,8 @@ const Table = class {
|
|
|
30924
30927
|
this.shouldSort = true;
|
|
30925
30928
|
}
|
|
30926
30929
|
updateAggregates(newAggregates, oldAggregates) {
|
|
30927
|
-
if (!this.tabulator) {
|
|
30930
|
+
if (!this.tabulator || !this.initialized) {
|
|
30931
|
+
this.pendingColumnRefresh = true;
|
|
30928
30932
|
return;
|
|
30929
30933
|
}
|
|
30930
30934
|
if (isEqual.isEqual(newAggregates, oldAggregates)) {
|
|
@@ -30960,7 +30964,8 @@ const Table = class {
|
|
|
30960
30964
|
}
|
|
30961
30965
|
updateSortableColumns() {
|
|
30962
30966
|
this.warnOnConflictingMovableAndSortable();
|
|
30963
|
-
if (!this.tabulator) {
|
|
30967
|
+
if (!this.tabulator || !this.initialized) {
|
|
30968
|
+
this.pendingColumnRefresh = true;
|
|
30964
30969
|
return;
|
|
30965
30970
|
}
|
|
30966
30971
|
this.tabulator.setColumns(this.getColumnDefinitions());
|
|
@@ -31095,6 +31100,7 @@ const Table = class {
|
|
|
31095
31100
|
return;
|
|
31096
31101
|
}
|
|
31097
31102
|
this.initialized = true;
|
|
31103
|
+
this.applyPendingColumnRefresh();
|
|
31098
31104
|
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.length) {
|
|
31099
31105
|
this.updateData(this.data, []);
|
|
31100
31106
|
if (this.isRemoteMode()) {
|
|
@@ -31107,6 +31113,14 @@ const Table = class {
|
|
|
31107
31113
|
});
|
|
31108
31114
|
return tabulator;
|
|
31109
31115
|
}
|
|
31116
|
+
applyPendingColumnRefresh() {
|
|
31117
|
+
if (!this.pendingColumnRefresh || !this.tabulator) {
|
|
31118
|
+
return;
|
|
31119
|
+
}
|
|
31120
|
+
this.pendingColumnRefresh = false;
|
|
31121
|
+
this.tabulator.setColumns(this.getColumnDefinitions());
|
|
31122
|
+
this.tabulator.recalc();
|
|
31123
|
+
}
|
|
31110
31124
|
initRowDragManager() {
|
|
31111
31125
|
if (this.movableRows) {
|
|
31112
31126
|
this.rowDragManager = new RowDragManager(this.pool, this.reorder, () => this.language);
|
|
@@ -31412,13 +31426,13 @@ const Table = class {
|
|
|
31412
31426
|
render() {
|
|
31413
31427
|
var _a, _b;
|
|
31414
31428
|
const totalRows = (_a = this.totalRows) !== null && _a !== void 0 ? _a : this.data.length;
|
|
31415
|
-
return (index.h(index.Host, { key: '
|
|
31429
|
+
return (index.h(index.Host, { key: 'bdf212a18d552e674b125bc7211720a4c12017c9', class: {
|
|
31416
31430
|
'has-low-density': this.layout === 'lowDensity',
|
|
31417
31431
|
'has-pagination-on-top': this.paginationLocation === 'top',
|
|
31418
31432
|
'has-aggregation': this.hasAggregation(this.columns),
|
|
31419
31433
|
'has-pagination': totalRows > this.pageSize,
|
|
31420
31434
|
'has-selection': (_b = this.tableSelection) === null || _b === void 0 ? void 0 : _b.hasSelection,
|
|
31421
|
-
} }, index.h("div", { key: '
|
|
31435
|
+
} }, index.h("div", { key: '7e2255cc81d1df9ec44b0b10de49ef1dff6c6119', id: "tabulator-container" }, index.h("div", { key: 'c413d5abefd874be1d7da0764ff6c8b41c096ec0', id: "tabulator-loader", style: { display: this.loading ? 'flex' : 'none' } }, index.h("limel-spinner", { key: 'f2018824ceef425f572839540a543d71d19b77b3', size: "large" })), this.renderEmptyMessage(), this.renderSelectAll(), index.h("div", { key: '27dcea556552419f9c904320192c847b94742d2c', id: "tabulator-table" }))));
|
|
31422
31436
|
}
|
|
31423
31437
|
renderSelectAll() {
|
|
31424
31438
|
var _a, _b, _c;
|
|
@@ -74,6 +74,7 @@ export class Table {
|
|
|
74
74
|
*/
|
|
75
75
|
this.paginationLocation = 'bottom';
|
|
76
76
|
this.initialized = false;
|
|
77
|
+
this.pendingColumnRefresh = false;
|
|
77
78
|
this.destroyed = false;
|
|
78
79
|
this.shouldSort = false;
|
|
79
80
|
this.hasWarnedOnConflictingMovableAndSortable = false;
|
|
@@ -162,6 +163,7 @@ export class Table {
|
|
|
162
163
|
var _a;
|
|
163
164
|
this.destroyed = true;
|
|
164
165
|
this.initialized = false;
|
|
166
|
+
this.pendingColumnRefresh = false;
|
|
165
167
|
(_a = this.rowDragManager) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
166
168
|
this.rowDragManager = null;
|
|
167
169
|
if (this.resizeObserver) {
|
|
@@ -229,7 +231,8 @@ export class Table {
|
|
|
229
231
|
});
|
|
230
232
|
}
|
|
231
233
|
updateColumns(newColumns, oldColumns) {
|
|
232
|
-
if (!this.tabulator) {
|
|
234
|
+
if (!this.tabulator || !this.initialized) {
|
|
235
|
+
this.pendingColumnRefresh = true;
|
|
233
236
|
return;
|
|
234
237
|
}
|
|
235
238
|
if (this.areSameColumns(newColumns, oldColumns)) {
|
|
@@ -246,7 +249,8 @@ export class Table {
|
|
|
246
249
|
this.shouldSort = true;
|
|
247
250
|
}
|
|
248
251
|
updateAggregates(newAggregates, oldAggregates) {
|
|
249
|
-
if (!this.tabulator) {
|
|
252
|
+
if (!this.tabulator || !this.initialized) {
|
|
253
|
+
this.pendingColumnRefresh = true;
|
|
250
254
|
return;
|
|
251
255
|
}
|
|
252
256
|
if (isEqual(newAggregates, oldAggregates)) {
|
|
@@ -282,7 +286,8 @@ export class Table {
|
|
|
282
286
|
}
|
|
283
287
|
updateSortableColumns() {
|
|
284
288
|
this.warnOnConflictingMovableAndSortable();
|
|
285
|
-
if (!this.tabulator) {
|
|
289
|
+
if (!this.tabulator || !this.initialized) {
|
|
290
|
+
this.pendingColumnRefresh = true;
|
|
286
291
|
return;
|
|
287
292
|
}
|
|
288
293
|
this.tabulator.setColumns(this.getColumnDefinitions());
|
|
@@ -417,6 +422,7 @@ export class Table {
|
|
|
417
422
|
return;
|
|
418
423
|
}
|
|
419
424
|
this.initialized = true;
|
|
425
|
+
this.applyPendingColumnRefresh();
|
|
420
426
|
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.length) {
|
|
421
427
|
this.updateData(this.data, []);
|
|
422
428
|
if (this.isRemoteMode()) {
|
|
@@ -429,6 +435,14 @@ export class Table {
|
|
|
429
435
|
});
|
|
430
436
|
return tabulator;
|
|
431
437
|
}
|
|
438
|
+
applyPendingColumnRefresh() {
|
|
439
|
+
if (!this.pendingColumnRefresh || !this.tabulator) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
this.pendingColumnRefresh = false;
|
|
443
|
+
this.tabulator.setColumns(this.getColumnDefinitions());
|
|
444
|
+
this.tabulator.recalc();
|
|
445
|
+
}
|
|
432
446
|
initRowDragManager() {
|
|
433
447
|
if (this.movableRows) {
|
|
434
448
|
this.rowDragManager = new RowDragManager(this.pool, this.reorder, () => this.language);
|
|
@@ -734,13 +748,13 @@ export class Table {
|
|
|
734
748
|
render() {
|
|
735
749
|
var _a, _b;
|
|
736
750
|
const totalRows = (_a = this.totalRows) !== null && _a !== void 0 ? _a : this.data.length;
|
|
737
|
-
return (h(Host, { key: '
|
|
751
|
+
return (h(Host, { key: 'bdf212a18d552e674b125bc7211720a4c12017c9', class: {
|
|
738
752
|
'has-low-density': this.layout === 'lowDensity',
|
|
739
753
|
'has-pagination-on-top': this.paginationLocation === 'top',
|
|
740
754
|
'has-aggregation': this.hasAggregation(this.columns),
|
|
741
755
|
'has-pagination': totalRows > this.pageSize,
|
|
742
756
|
'has-selection': (_b = this.tableSelection) === null || _b === void 0 ? void 0 : _b.hasSelection,
|
|
743
|
-
} }, h("div", { key: '
|
|
757
|
+
} }, h("div", { key: '7e2255cc81d1df9ec44b0b10de49ef1dff6c6119', id: "tabulator-container" }, h("div", { key: 'c413d5abefd874be1d7da0764ff6c8b41c096ec0', id: "tabulator-loader", style: { display: this.loading ? 'flex' : 'none' } }, h("limel-spinner", { key: 'f2018824ceef425f572839540a543d71d19b77b3', size: "large" })), this.renderEmptyMessage(), this.renderSelectAll(), h("div", { key: '27dcea556552419f9c904320192c847b94742d2c', id: "tabulator-table" }))));
|
|
744
758
|
}
|
|
745
759
|
renderSelectAll() {
|
|
746
760
|
var _a, _b, _c;
|
package/dist/collection/components/text-editor/prosemirror-adapter/plugins/table-paste-plugin.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Plugin, PluginKey, Selection } from "prosemirror-state";
|
|
2
|
+
import { Fragment, Slice } from "prosemirror-model";
|
|
3
|
+
import { cellAround, CellSelection, isInTable, TableMap, tableNodeTypes, } from "prosemirror-tables";
|
|
4
|
+
export const createTablePastePlugin = () => {
|
|
5
|
+
return new Plugin({
|
|
6
|
+
key: new PluginKey('tablePastePlugin'),
|
|
7
|
+
props: {
|
|
8
|
+
handlePaste: (view, _event, slice) => {
|
|
9
|
+
return handleTablePaste(view, slice);
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
// prosemirror-tables pastes a cell grid over the existing cells. Unless the
|
|
15
|
+
// user selected cells explicitly, pasted cells become rows of the table (or
|
|
16
|
+
// a new table) instead.
|
|
17
|
+
const handleTablePaste = (view, slice) => {
|
|
18
|
+
const { state } = view;
|
|
19
|
+
if (state.selection instanceof CellSelection || !isInTable(state)) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const rows = pastedRows(slice, state.schema);
|
|
23
|
+
if (!rows && !containsTableAmongBlocks(slice)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const tr = state.tr.deleteSelection();
|
|
27
|
+
const $cell = cellAround(tr.selection.$head);
|
|
28
|
+
if (rows) {
|
|
29
|
+
insertRows(tr, $cell, rows);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
insertBlocks(tr, $cell, slice.content);
|
|
33
|
+
}
|
|
34
|
+
view.dispatch(tr.scrollIntoView());
|
|
35
|
+
return true;
|
|
36
|
+
};
|
|
37
|
+
const insertRows = (tr, $cell, rows) => {
|
|
38
|
+
const table = tableNodeTypes(tr.doc.type.schema).table.create(null, rows);
|
|
39
|
+
if ($cell && rowsFitBelow($cell, TableMap.get(table).width)) {
|
|
40
|
+
insertAt(tr, $cell.after(), rows);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
insertBlocks(tr, $cell, Fragment.from(table));
|
|
44
|
+
};
|
|
45
|
+
const insertBlocks = (tr, $cell, blocks) => {
|
|
46
|
+
if ($cell) {
|
|
47
|
+
insertAt(tr, $cell.after(-1), blocks);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
tr.replaceSelection(new Slice(blocks, 0, 0));
|
|
51
|
+
};
|
|
52
|
+
const insertAt = (tr, pos, content) => {
|
|
53
|
+
const step = tr.steps.length;
|
|
54
|
+
tr.insert(pos, content);
|
|
55
|
+
const end = tr.mapping.slice(step).mapResult(pos, 1).pos;
|
|
56
|
+
tr.setSelection(Selection.near(tr.doc.resolve(end), -1));
|
|
57
|
+
};
|
|
58
|
+
// A new row would split any cell spanning the boundary below the caret's row.
|
|
59
|
+
const rowsFitBelow = ($cell, width) => {
|
|
60
|
+
const map = TableMap.get($cell.node(-1));
|
|
61
|
+
if (width !== map.width) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const boundary = map.findCell($cell.pos - $cell.start(-1)).top + 1;
|
|
65
|
+
if (boundary >= map.height) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
for (let col = 0; col < map.width; col++) {
|
|
69
|
+
const above = map.map[(boundary - 1) * map.width + col];
|
|
70
|
+
const below = map.map[boundary * map.width + col];
|
|
71
|
+
if (above === below) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
};
|
|
77
|
+
// Reads the slice the way prosemirror-tables does: strip the wrappers a copy
|
|
78
|
+
// from inside a table leaves around the content, then accept rows or cells.
|
|
79
|
+
const pastedRows = (slice, schema) => {
|
|
80
|
+
var _a;
|
|
81
|
+
let { content, openStart, openEnd } = slice;
|
|
82
|
+
while (content.childCount === 1 &&
|
|
83
|
+
((openStart > 0 && openEnd > 0) ||
|
|
84
|
+
content.firstChild.type.spec.tableRole === 'table')) {
|
|
85
|
+
openStart--;
|
|
86
|
+
openEnd--;
|
|
87
|
+
content = content.firstChild.content;
|
|
88
|
+
}
|
|
89
|
+
const role = (_a = content.firstChild) === null || _a === void 0 ? void 0 : _a.type.spec.tableRole;
|
|
90
|
+
if (role === 'row') {
|
|
91
|
+
return content;
|
|
92
|
+
}
|
|
93
|
+
if (role === 'cell' || role === 'header_cell') {
|
|
94
|
+
return Fragment.from(tableNodeTypes(schema).row.create(null, content));
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
98
|
+
const containsTableAmongBlocks = (slice) => {
|
|
99
|
+
if (slice.content.childCount < 2) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
return slice.content.content.some((block) => block.type.spec.tableRole === 'table');
|
|
103
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { tableNodes, tableEditing } from "prosemirror-tables";
|
|
2
|
+
import { createTablePastePlugin } from "./table-paste-plugin";
|
|
2
3
|
export const getTableEditingPlugins = (tablesEnabled) => {
|
|
3
4
|
if (tablesEnabled) {
|
|
4
|
-
|
|
5
|
+
// The paste plugin must precede tableEditing(), whose own
|
|
6
|
+
// handlePaste would otherwise consume table pastes first.
|
|
7
|
+
return [createTablePastePlugin(), tableEditing()];
|
|
5
8
|
}
|
|
6
9
|
return [];
|
|
7
10
|
};
|
|
@@ -581,6 +581,17 @@ img {
|
|
|
581
581
|
display: flex;
|
|
582
582
|
flex-direction: column;
|
|
583
583
|
}
|
|
584
|
+
:host(limel-prosemirror-adapter) table {
|
|
585
|
+
border-collapse: collapse;
|
|
586
|
+
margin: 0.75rem 0;
|
|
587
|
+
}
|
|
588
|
+
:host(limel-prosemirror-adapter) th,
|
|
589
|
+
:host(limel-prosemirror-adapter) td {
|
|
590
|
+
border: 1px solid rgb(var(--contrast-400));
|
|
591
|
+
padding: 0.25rem 0.375rem;
|
|
592
|
+
text-align: left;
|
|
593
|
+
vertical-align: top;
|
|
594
|
+
}
|
|
584
595
|
:host(limel-prosemirror-adapter) .toolbar {
|
|
585
596
|
order: 1;
|
|
586
597
|
}
|