@limetech/lime-elements 38.2.3 → 38.3.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/CHANGELOG.md +9 -0
- package/dist/cjs/files-c08d24d4.js +44 -0
- package/dist/cjs/files-c08d24d4.js.map +1 -0
- package/dist/cjs/index.cjs.js +9 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/limel-action-bar_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-callout.cjs.entry.js +1 -1
- package/dist/cjs/limel-chart.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +8 -43
- package/dist/cjs/limel-file-dropzone_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-file-viewer.cjs.entry.js +1 -1
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-linear-progress.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +404 -19
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js +11 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
- package/dist/cjs/text-editor.types-5e5567e2.js +13 -0
- package/dist/cjs/text-editor.types-5e5567e2.js.map +1 -0
- package/dist/cjs/{translations-0d53f9bc.js → translations-9be59477.js} +42 -3
- package/dist/cjs/translations-9be59477.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/inserter.js +195 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/inserter.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/node.js +128 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/node.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/view.js +139 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/view.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.css +187 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +60 -3
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/collection/components/text-editor/text-editor.js +63 -1
- package/dist/collection/components/text-editor/text-editor.js.map +1 -1
- package/dist/collection/components/text-editor/text-editor.types.js +9 -1
- package/dist/collection/components/text-editor/text-editor.types.js.map +1 -1
- package/dist/collection/components/text-editor/utils/html-converter.js +7 -4
- package/dist/collection/components/text-editor/utils/html-converter.js.map +1 -1
- package/dist/collection/components/text-editor/utils/markdown-converter.js +8 -8
- package/dist/collection/components/text-editor/utils/markdown-converter.js.map +1 -1
- package/dist/collection/global/translations.js +9 -2
- package/dist/collection/global/translations.js.map +1 -1
- package/dist/collection/translations/da.js +4 -0
- package/dist/collection/translations/da.js.map +1 -1
- package/dist/collection/translations/de.js +4 -0
- package/dist/collection/translations/de.js.map +1 -1
- package/dist/collection/translations/en.js +4 -0
- package/dist/collection/translations/en.js.map +1 -1
- package/dist/collection/translations/fi.js +4 -0
- package/dist/collection/translations/fi.js.map +1 -1
- package/dist/collection/translations/fr.js +4 -0
- package/dist/collection/translations/fr.js.map +1 -1
- package/dist/collection/translations/nl.js +4 -0
- package/dist/collection/translations/nl.js.map +1 -1
- package/dist/collection/translations/no.js +4 -0
- package/dist/collection/translations/no.js.map +1 -1
- package/dist/collection/translations/sv.js +4 -0
- package/dist/collection/translations/sv.js.map +1 -1
- package/dist/esm/files-2be62a61.js +41 -0
- package/dist/esm/files-2be62a61.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/limel-action-bar_2.entry.js +1 -1
- package/dist/esm/limel-callout.entry.js +1 -1
- package/dist/esm/limel-chart.entry.js +1 -1
- package/dist/esm/limel-chip_2.entry.js +1 -1
- package/dist/esm/limel-file-dropzone_2.entry.js +2 -37
- package/dist/esm/limel-file-dropzone_2.entry.js.map +1 -1
- package/dist/esm/limel-file-viewer.entry.js +1 -1
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
- package/dist/esm/limel-linear-progress.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +404 -19
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/limel-snackbar.entry.js +1 -1
- package/dist/esm/limel-text-editor.entry.js +11 -1
- package/dist/esm/limel-text-editor.entry.js.map +1 -1
- package/dist/esm/text-editor.types-e82469d1.js +13 -0
- package/dist/esm/text-editor.types-e82469d1.js.map +1 -0
- package/dist/esm/{translations-7ad188e0.js → translations-4f7370c2.js} +42 -3
- package/dist/esm/translations-4f7370c2.js.map +1 -0
- package/dist/lime-elements/index.esm.js +1 -1
- package/dist/lime-elements/index.esm.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-ffe954d4.entry.js → p-01ba32ab.entry.js} +2 -2
- package/dist/lime-elements/p-032d839e.js +2 -0
- package/dist/lime-elements/p-032d839e.js.map +1 -0
- package/dist/lime-elements/p-1906d5b7.entry.js +2 -0
- package/dist/lime-elements/p-1906d5b7.entry.js.map +1 -0
- package/dist/lime-elements/{p-8ada443f.entry.js → p-22d0e2ec.entry.js} +2 -2
- package/dist/lime-elements/{p-0468e34c.entry.js → p-23dea768.entry.js} +2 -2
- package/dist/lime-elements/{p-fc7f9e93.entry.js → p-30b0e067.entry.js} +2 -2
- package/dist/lime-elements/{p-180675a5.entry.js → p-475830f8.entry.js} +2 -2
- package/dist/lime-elements/{p-7fdab6b0.entry.js → p-62a21e92.entry.js} +2 -2
- package/dist/lime-elements/p-62a21e92.entry.js.map +1 -0
- package/dist/lime-elements/{p-54b4a06b.entry.js → p-8e8c1557.entry.js} +2 -2
- package/dist/lime-elements/p-9ca516ed.js +2 -0
- package/dist/lime-elements/p-9ca516ed.js.map +1 -0
- package/dist/lime-elements/{p-28c6b698.entry.js → p-a2a2fc57.entry.js} +2 -2
- package/dist/lime-elements/{p-b78a9a5c.entry.js → p-b66ee3a1.entry.js} +2 -2
- package/dist/lime-elements/p-dbcde7db.entry.js +2 -0
- package/dist/lime-elements/p-dbcde7db.entry.js.map +1 -0
- package/dist/lime-elements/p-dc3d2ee1.js +2 -0
- package/dist/lime-elements/p-dc3d2ee1.js.map +1 -0
- package/dist/lime-elements/{p-fefef194.entry.js → p-f50e4b6f.entry.js} +2 -2
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/inserter.d.ts +15 -0
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/node.d.ts +14 -0
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/view.d.ts +4 -0
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +14 -0
- package/dist/types/components/text-editor/text-editor.d.ts +18 -0
- package/dist/types/components/text-editor/text-editor.types.d.ts +51 -0
- package/dist/types/components/text-editor/utils/markdown-converter.d.ts +2 -1
- package/dist/types/components.d.ts +34 -2
- package/dist/types/global/translations.d.ts +1 -1
- package/dist/types/translations/da.d.ts +4 -0
- package/dist/types/translations/de.d.ts +4 -0
- package/dist/types/translations/en.d.ts +4 -0
- package/dist/types/translations/fi.d.ts +4 -0
- package/dist/types/translations/fr.d.ts +4 -0
- package/dist/types/translations/nl.d.ts +4 -0
- package/dist/types/translations/no.d.ts +4 -0
- package/dist/types/translations/sv.d.ts +4 -0
- package/package.json +1 -1
- package/dist/cjs/translations-0d53f9bc.js.map +0 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image-remover-plugin.js +0 -78
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image-remover-plugin.js.map +0 -1
- package/dist/esm/translations-7ad188e0.js.map +0 -1
- package/dist/lime-elements/p-7fdab6b0.entry.js.map +0 -1
- package/dist/lime-elements/p-ad9801f8.entry.js +0 -2
- package/dist/lime-elements/p-ad9801f8.entry.js.map +0 -1
- package/dist/lime-elements/p-e5545944.entry.js +0 -2
- package/dist/lime-elements/p-e5545944.entry.js.map +0 -1
- package/dist/lime-elements/p-efd753ba.js +0 -2
- package/dist/lime-elements/p-efd753ba.js.map +0 -1
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image-remover-plugin.d.ts +0 -4
- /package/dist/lime-elements/{p-ffe954d4.entry.js.map → p-01ba32ab.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-8ada443f.entry.js.map → p-22d0e2ec.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-0468e34c.entry.js.map → p-23dea768.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-fc7f9e93.entry.js.map → p-30b0e067.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-180675a5.entry.js.map → p-475830f8.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-54b4a06b.entry.js.map → p-8e8c1557.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-28c6b698.entry.js.map → p-a2a2fc57.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-b78a9a5c.entry.js.map → p-b66ee3a1.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-fefef194.entry.js.map → p-f50e4b6f.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement } from './index-6156b4fd.js';
|
|
2
|
-
import { t as translate } from './translations-
|
|
2
|
+
import { t as translate } from './translations-4f7370c2.js';
|
|
3
3
|
|
|
4
4
|
const linearProgressCss = ":host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host(limel-linear-progress){isolation:isolate;position:relative;overflow:hidden;display:flex;width:100%;height:0.25rem;border-radius:0.25rem;background-color:var(--background-color, rgb(var(--contrast-800), 0.5))}.progress{height:100%;width:var(--percentage, 0%);border-radius:0.25rem;background-color:var(--mdc-theme-primary)}:host(limel-linear-progress[indeterminate]) .progress{background-color:transparent;width:100%}:host(limel-linear-progress[indeterminate]) .progress:before,:host(limel-linear-progress[indeterminate]) .progress:after{will-change:left, right, opacity;content:\"\";position:absolute;inset:0;height:100%;border-radius:0.25rem;opacity:0;background-color:var(--mdc-theme-primary)}:host(limel-linear-progress[indeterminate]) .progress:before{animation:indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite}:host(limel-linear-progress[indeterminate]) .progress:after{animation:indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite 1.15s}@keyframes indeterminate{0%{left:-35%;right:100%;opacity:0}10%,80%{opacity:1}60%{left:100%;right:-90%}100%{left:100%;right:-90%;opacity:0}}@keyframes indeterminate-short{0%{left:-200%;right:100%;opacity:0}10%,80%{opacity:1}60%{left:107%;right:-8%}100%{left:107%;right:-8%;opacity:0}}";
|
|
5
5
|
|
|
@@ -9,9 +9,11 @@ import { g as getPrototype } from './_getPrototype-8096728a.js';
|
|
|
9
9
|
import { i as isArray } from './isArray-80298bc7.js';
|
|
10
10
|
import { i as isObjectLike } from './isObjectLike-38996507.js';
|
|
11
11
|
import { d as decodeHTML, m as markdownToHTML, s as sanitizeHTML } from './markdown-parser-47476fc0.js';
|
|
12
|
-
import {
|
|
12
|
+
import { I as ImageState } from './text-editor.types-e82469d1.js';
|
|
13
|
+
import { t as translate$1 } from './translations-4f7370c2.js';
|
|
13
14
|
import { c as createRandomString } from './random-string-e74dc48d.js';
|
|
14
15
|
import { i as isItem } from './isItem-b0459122.js';
|
|
16
|
+
import { c as createFileInfo } from './files-2be62a61.js';
|
|
15
17
|
import { i as isEqual } from './isEqual-2c139334.js';
|
|
16
18
|
import { d as debounce } from './debounce-9a05c91c.js';
|
|
17
19
|
import './eq-c1c7f528.js';
|
|
@@ -20,6 +22,8 @@ import './_isIndex-6de44c7b.js';
|
|
|
20
22
|
import './isArrayLike-6597c815.js';
|
|
21
23
|
import './_defineProperty-2105cb48.js';
|
|
22
24
|
import './_commonjsHelpers-5ec8f9b7.js';
|
|
25
|
+
import './file-metadata-01403ecd.js';
|
|
26
|
+
import './get-icon-props-5a77e17e.js';
|
|
23
27
|
import './toNumber-a6ed64f0.js';
|
|
24
28
|
import './isSymbol-5bf20921.js';
|
|
25
29
|
|
|
@@ -25899,6 +25903,132 @@ class MarkdownSerializerState {
|
|
|
25899
25903
|
}
|
|
25900
25904
|
}
|
|
25901
25905
|
|
|
25906
|
+
const imageCache = new Map();
|
|
25907
|
+
function getImageNode(language) {
|
|
25908
|
+
return { image: createImageNodeSpec(language) };
|
|
25909
|
+
}
|
|
25910
|
+
function getImageNodeMarkdownSerializer(language) {
|
|
25911
|
+
return { image: createImageNodeMarkdownSerializer(language) };
|
|
25912
|
+
}
|
|
25913
|
+
/**
|
|
25914
|
+
* Recursively checks if a ProseMirror node or
|
|
25915
|
+
* any of its child nodes is an image node.
|
|
25916
|
+
*/
|
|
25917
|
+
function hasImageNode(node) {
|
|
25918
|
+
if (node.type.name === 'image') {
|
|
25919
|
+
return true;
|
|
25920
|
+
}
|
|
25921
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
25922
|
+
const childNode = node.child(i);
|
|
25923
|
+
if (hasImageNode(childNode)) {
|
|
25924
|
+
return true;
|
|
25925
|
+
}
|
|
25926
|
+
}
|
|
25927
|
+
return false;
|
|
25928
|
+
}
|
|
25929
|
+
function createImageNodeMarkdownSerializer(language) {
|
|
25930
|
+
return (state, node) => {
|
|
25931
|
+
if (node.attrs.state === ImageState.FAILED) {
|
|
25932
|
+
const text = translate$1.get('editor-image-view.failed', language, {
|
|
25933
|
+
filename: node.attrs.alt || 'file',
|
|
25934
|
+
});
|
|
25935
|
+
state.write(`<span>${text}</span>`);
|
|
25936
|
+
return;
|
|
25937
|
+
}
|
|
25938
|
+
else if (node.attrs.state === ImageState.LOADING) {
|
|
25939
|
+
const text = translate$1.get('editor-image-view.loading', language, {
|
|
25940
|
+
filename: node.attrs.alt || 'file',
|
|
25941
|
+
});
|
|
25942
|
+
state.write(`<span>${text}</span>`);
|
|
25943
|
+
return;
|
|
25944
|
+
}
|
|
25945
|
+
let imageHTML = `<img src="${node.attrs.src}"`;
|
|
25946
|
+
if (node.attrs.alt) {
|
|
25947
|
+
imageHTML += ` alt="${node.attrs.alt}"`;
|
|
25948
|
+
}
|
|
25949
|
+
const style = [];
|
|
25950
|
+
if (node.attrs.width) {
|
|
25951
|
+
style.push(`width: ${node.attrs.width};`);
|
|
25952
|
+
}
|
|
25953
|
+
if (node.attrs.maxWidth) {
|
|
25954
|
+
style.push(`max-width: ${node.attrs.maxWidth};`);
|
|
25955
|
+
}
|
|
25956
|
+
if (style.length > 0) {
|
|
25957
|
+
imageHTML += ` style="${style.join(' ')}"`;
|
|
25958
|
+
}
|
|
25959
|
+
imageHTML += ' />';
|
|
25960
|
+
state.write(imageHTML);
|
|
25961
|
+
};
|
|
25962
|
+
}
|
|
25963
|
+
function createImageNodeSpec(language) {
|
|
25964
|
+
return {
|
|
25965
|
+
group: 'inline',
|
|
25966
|
+
inline: true,
|
|
25967
|
+
attrs: {
|
|
25968
|
+
src: { default: '' },
|
|
25969
|
+
alt: { default: '' },
|
|
25970
|
+
fileInfoId: { default: '' },
|
|
25971
|
+
width: { default: '' },
|
|
25972
|
+
maxWidth: { default: '100%' },
|
|
25973
|
+
state: { default: '' },
|
|
25974
|
+
},
|
|
25975
|
+
toDOM: (node) => {
|
|
25976
|
+
if (node.attrs.state === ImageState.FAILED) {
|
|
25977
|
+
return createStatusSpan('failed', node, language);
|
|
25978
|
+
}
|
|
25979
|
+
else if (node.attrs.state === ImageState.LOADING) {
|
|
25980
|
+
return createStatusSpan('loading', node, language);
|
|
25981
|
+
}
|
|
25982
|
+
let img = imageCache.get(node.attrs.fileInfoId);
|
|
25983
|
+
if (img) {
|
|
25984
|
+
updateImageElement(img, node);
|
|
25985
|
+
}
|
|
25986
|
+
else {
|
|
25987
|
+
img = createImageElement(node);
|
|
25988
|
+
imageCache.set(node.attrs.fileInfoId, img);
|
|
25989
|
+
}
|
|
25990
|
+
return img;
|
|
25991
|
+
},
|
|
25992
|
+
parseDOM: [
|
|
25993
|
+
{
|
|
25994
|
+
tag: 'img',
|
|
25995
|
+
getAttrs: (dom) => {
|
|
25996
|
+
return {
|
|
25997
|
+
src: dom.getAttribute('src') || '',
|
|
25998
|
+
alt: dom.getAttribute('alt') || 'file',
|
|
25999
|
+
width: dom.style.width || '',
|
|
26000
|
+
maxWidth: '100%',
|
|
26001
|
+
state: ImageState.SUCCESS,
|
|
26002
|
+
fileInfoId: crypto.randomUUID(),
|
|
26003
|
+
};
|
|
26004
|
+
},
|
|
26005
|
+
},
|
|
26006
|
+
],
|
|
26007
|
+
};
|
|
26008
|
+
}
|
|
26009
|
+
function createStatusSpan(key, node, language) {
|
|
26010
|
+
const text = translate$1.get(`editor-image-view.${key}`, language, {
|
|
26011
|
+
filename: node.attrs.alt || 'file',
|
|
26012
|
+
});
|
|
26013
|
+
const span = document.createElement('span');
|
|
26014
|
+
span.textContent = text;
|
|
26015
|
+
return span;
|
|
26016
|
+
}
|
|
26017
|
+
function updateImageElement(img, node) {
|
|
26018
|
+
img.alt = node.attrs.alt;
|
|
26019
|
+
img.style.maxWidth = node.attrs.maxWidth;
|
|
26020
|
+
img.style.width = node.attrs.width;
|
|
26021
|
+
return img;
|
|
26022
|
+
}
|
|
26023
|
+
function createImageElement(node) {
|
|
26024
|
+
const img = document.createElement('img');
|
|
26025
|
+
img.src = node.attrs.src;
|
|
26026
|
+
img.alt = node.attrs.alt;
|
|
26027
|
+
img.style.maxWidth = node.attrs.maxWidth;
|
|
26028
|
+
img.style.width = node.attrs.width;
|
|
26029
|
+
return img;
|
|
26030
|
+
}
|
|
26031
|
+
|
|
25902
26032
|
const createMarkdownSerializerFunction = (config) => {
|
|
25903
26033
|
return (state, node) => {
|
|
25904
26034
|
const tagOpen = `<${config.tagName}` +
|
|
@@ -25912,12 +26042,12 @@ const createMarkdownSerializerFunction = (config) => {
|
|
|
25912
26042
|
state.write(tagClose);
|
|
25913
26043
|
};
|
|
25914
26044
|
};
|
|
25915
|
-
const buildMarkdownSerializer = (plugins) => {
|
|
26045
|
+
const buildMarkdownSerializer = (plugins, language) => {
|
|
25916
26046
|
const customNodes = {};
|
|
25917
26047
|
plugins.forEach((plugin) => {
|
|
25918
26048
|
customNodes[plugin.tagName] = createMarkdownSerializerFunction(plugin);
|
|
25919
26049
|
});
|
|
25920
|
-
const nodes = Object.assign(Object.assign({}, defaultMarkdownSerializer.nodes), customNodes);
|
|
26050
|
+
const nodes = Object.assign(Object.assign(Object.assign({}, defaultMarkdownSerializer.nodes), getImageNodeMarkdownSerializer(language)), customNodes);
|
|
25921
26051
|
const marks = Object.assign(Object.assign({}, defaultMarkdownSerializer.marks), { strikethrough: {
|
|
25922
26052
|
open: '~~',
|
|
25923
26053
|
close: '~~',
|
|
@@ -25930,19 +26060,18 @@ const buildMarkdownSerializer = (plugins) => {
|
|
|
25930
26060
|
* @private
|
|
25931
26061
|
*/
|
|
25932
26062
|
class MarkdownConverter {
|
|
25933
|
-
constructor(plugins) {
|
|
26063
|
+
constructor(plugins, language) {
|
|
25934
26064
|
this.parseAsHTML = (text) => {
|
|
25935
26065
|
return markdownToHTML(text, { whitelist: this.customNodes });
|
|
25936
26066
|
};
|
|
25937
26067
|
this.serialize = (view) => {
|
|
25938
|
-
if (view.dom.textContent === ''
|
|
26068
|
+
if (view.dom.textContent.trim() === '' &&
|
|
26069
|
+
!hasImageNode(view.state.doc)) {
|
|
25939
26070
|
return '';
|
|
25940
26071
|
}
|
|
25941
|
-
|
|
25942
|
-
return this.markdownSerializer.serialize(view.state.doc);
|
|
25943
|
-
}
|
|
26072
|
+
return this.markdownSerializer.serialize(view.state.doc);
|
|
25944
26073
|
};
|
|
25945
|
-
this.markdownSerializer = buildMarkdownSerializer(plugins);
|
|
26074
|
+
this.markdownSerializer = buildMarkdownSerializer(plugins, language);
|
|
25946
26075
|
this.customNodes = plugins;
|
|
25947
26076
|
}
|
|
25948
26077
|
}
|
|
@@ -25956,12 +26085,13 @@ class HTMLConverter {
|
|
|
25956
26085
|
return sanitizeHTML(text, this.customNodes);
|
|
25957
26086
|
};
|
|
25958
26087
|
this.serialize = (view) => {
|
|
25959
|
-
if (view.dom.textContent === ''
|
|
26088
|
+
if (view.dom.textContent.trim() === '' &&
|
|
26089
|
+
!hasImageNode(view.state.doc)) {
|
|
25960
26090
|
return '';
|
|
25961
26091
|
}
|
|
25962
|
-
|
|
25963
|
-
|
|
25964
|
-
|
|
26092
|
+
const div = document.createElement('div');
|
|
26093
|
+
div.appendChild(DOMSerializer.fromSchema(view.state.schema).serializeFragment(view.state.doc.content));
|
|
26094
|
+
return div.innerHTML;
|
|
25965
26095
|
};
|
|
25966
26096
|
this.customNodes = plugins;
|
|
25967
26097
|
}
|
|
@@ -26166,16 +26296,110 @@ const createLinkPlugin = (updateLinkCallback) => {
|
|
|
26166
26296
|
});
|
|
26167
26297
|
};
|
|
26168
26298
|
|
|
26169
|
-
const pluginKey = new PluginKey('
|
|
26170
|
-
const
|
|
26299
|
+
const pluginKey = new PluginKey('imageInserterPlugin');
|
|
26300
|
+
const createImageInserterPlugin = (imagePastedCallback, imageRemovedCallback) => {
|
|
26171
26301
|
return new Plugin({
|
|
26172
26302
|
key: pluginKey,
|
|
26173
26303
|
props: {
|
|
26174
26304
|
handlePaste: (view, event, slice) => {
|
|
26175
26305
|
return processPasteEvent(view, event, slice);
|
|
26176
26306
|
},
|
|
26307
|
+
handleDOMEvents: {
|
|
26308
|
+
imagePasted: (_, event) => {
|
|
26309
|
+
imagePastedCallback(event.detail);
|
|
26310
|
+
},
|
|
26311
|
+
},
|
|
26177
26312
|
},
|
|
26313
|
+
state: {
|
|
26314
|
+
init: () => {
|
|
26315
|
+
return { insertedImages: {} };
|
|
26316
|
+
},
|
|
26317
|
+
apply: (tr, pluginState) => {
|
|
26318
|
+
const newState = Object.assign({}, pluginState);
|
|
26319
|
+
newState.insertedImages = getImagesFromTransaction(tr);
|
|
26320
|
+
findAndHandleRemovedImages(imageRemovedCallback, pluginState.insertedImages, newState.insertedImages);
|
|
26321
|
+
return newState;
|
|
26322
|
+
},
|
|
26323
|
+
},
|
|
26324
|
+
});
|
|
26325
|
+
};
|
|
26326
|
+
const getImagesFromTransaction = (tr) => {
|
|
26327
|
+
const images = {};
|
|
26328
|
+
tr.doc.descendants((node) => {
|
|
26329
|
+
if (node.type.name === 'image') {
|
|
26330
|
+
images[node.attrs.fileInfoId] = node;
|
|
26331
|
+
}
|
|
26332
|
+
});
|
|
26333
|
+
return images;
|
|
26334
|
+
};
|
|
26335
|
+
const findAndHandleRemovedImages = (imageRemovedCallback, previousImages, newImages) => {
|
|
26336
|
+
const removedKeys = Object.keys(previousImages).filter((key) => !(key in newImages));
|
|
26337
|
+
for (const removedKey of removedKeys) {
|
|
26338
|
+
const removedImage = previousImages[removedKey];
|
|
26339
|
+
const imageInfo = {
|
|
26340
|
+
fileInfoId: removedImage.attrs.fileInfoId,
|
|
26341
|
+
src: removedImage.attrs.src,
|
|
26342
|
+
state: removedImage.attrs.state,
|
|
26343
|
+
};
|
|
26344
|
+
imageRemovedCallback(imageInfo);
|
|
26345
|
+
imageCache.delete(removedImage.attrs.fileInfoId);
|
|
26346
|
+
}
|
|
26347
|
+
};
|
|
26348
|
+
const imageInserterFactory = (view, base64Data, fileInfo) => {
|
|
26349
|
+
return {
|
|
26350
|
+
fileInfo: fileInfo,
|
|
26351
|
+
insertThumbnail: createThumbnailInserter(view, base64Data, fileInfo),
|
|
26352
|
+
insertImage: createImageInserter(view, fileInfo),
|
|
26353
|
+
insertFailedThumbnail: createFailedThumbnailInserter(view, fileInfo),
|
|
26354
|
+
};
|
|
26355
|
+
};
|
|
26356
|
+
const createThumbnailInserter = (view, base64Data, fileInfo) => () => {
|
|
26357
|
+
const { state, dispatch } = view;
|
|
26358
|
+
const { schema } = state;
|
|
26359
|
+
const placeholderNode = schema.nodes.image.create({
|
|
26360
|
+
src: base64Data,
|
|
26361
|
+
alt: fileInfo.filename,
|
|
26362
|
+
fileInfoId: fileInfo.id,
|
|
26363
|
+
state: ImageState.LOADING,
|
|
26364
|
+
});
|
|
26365
|
+
const transaction = state.tr.replaceSelectionWith(placeholderNode);
|
|
26366
|
+
dispatch(transaction);
|
|
26367
|
+
};
|
|
26368
|
+
const createImageInserter = (view, fileInfo) => (src) => {
|
|
26369
|
+
const { state, dispatch } = view;
|
|
26370
|
+
const { schema } = state;
|
|
26371
|
+
const tr = state.tr;
|
|
26372
|
+
state.doc.descendants((node, pos) => {
|
|
26373
|
+
if (node.attrs.fileInfoId === fileInfo.id) {
|
|
26374
|
+
const imageNode = schema.nodes.image.create({
|
|
26375
|
+
src: src ? src : node.attrs.src,
|
|
26376
|
+
alt: fileInfo.filename,
|
|
26377
|
+
fileInfoId: fileInfo.id,
|
|
26378
|
+
state: ImageState.SUCCESS,
|
|
26379
|
+
});
|
|
26380
|
+
tr.replaceWith(pos, pos + node.nodeSize, imageNode);
|
|
26381
|
+
return false;
|
|
26382
|
+
}
|
|
26383
|
+
});
|
|
26384
|
+
dispatch(tr);
|
|
26385
|
+
};
|
|
26386
|
+
const createFailedThumbnailInserter = (view, fileInfo) => () => {
|
|
26387
|
+
const { state, dispatch } = view;
|
|
26388
|
+
const { schema } = state;
|
|
26389
|
+
const tr = state.tr;
|
|
26390
|
+
state.doc.descendants((node, pos) => {
|
|
26391
|
+
if (node.attrs.fileInfoId === fileInfo.id) {
|
|
26392
|
+
const errorPlaceholderNode = schema.nodes.image.create({
|
|
26393
|
+
src: node.attrs.src,
|
|
26394
|
+
alt: fileInfo.filename,
|
|
26395
|
+
fileInfoId: fileInfo.id,
|
|
26396
|
+
state: ImageState.FAILED,
|
|
26397
|
+
});
|
|
26398
|
+
tr.replaceWith(pos, pos + node.nodeSize, errorPlaceholderNode);
|
|
26399
|
+
return false;
|
|
26400
|
+
}
|
|
26178
26401
|
});
|
|
26402
|
+
dispatch(tr);
|
|
26179
26403
|
};
|
|
26180
26404
|
/**
|
|
26181
26405
|
* Check if a given ProseMirror node or fragment contains any image nodes.
|
|
@@ -26227,11 +26451,31 @@ const filterImageNodes = (fragment) => {
|
|
|
26227
26451
|
});
|
|
26228
26452
|
return Fragment.fromArray(filteredChildren);
|
|
26229
26453
|
};
|
|
26454
|
+
/**
|
|
26455
|
+
* Process a paste event and trigger an imagePasted event if an image file is pasted.
|
|
26456
|
+
* If an HTML image element is pasted, this image is filtered out from the slice content.
|
|
26457
|
+
*
|
|
26458
|
+
* @param view - The ProseMirror editor view.
|
|
26459
|
+
* @param event - The paste event.
|
|
26460
|
+
* @returns A boolean; True if an image file was pasted to prevent default paste behavior, otherwise false.
|
|
26461
|
+
*/
|
|
26230
26462
|
const processPasteEvent = (view, event, slice) => {
|
|
26231
26463
|
const clipboardData = event.clipboardData;
|
|
26232
26464
|
if (!clipboardData) {
|
|
26233
26465
|
return false;
|
|
26234
26466
|
}
|
|
26467
|
+
const files = Array.from(clipboardData.files || []);
|
|
26468
|
+
for (const file of files) {
|
|
26469
|
+
if (file.type.startsWith('image/')) {
|
|
26470
|
+
const reader = new FileReader();
|
|
26471
|
+
reader.onloadend = () => {
|
|
26472
|
+
view.dom.dispatchEvent(new CustomEvent('imagePasted', {
|
|
26473
|
+
detail: imageInserterFactory(view, reader.result, createFileInfo(file)),
|
|
26474
|
+
}));
|
|
26475
|
+
};
|
|
26476
|
+
reader.readAsDataURL(file);
|
|
26477
|
+
}
|
|
26478
|
+
}
|
|
26235
26479
|
const filteredSlice = new Slice(filterImageNodes(slice.content), slice.openStart, slice.openEnd);
|
|
26236
26480
|
if (filteredSlice.content.childCount < slice.content.childCount) {
|
|
26237
26481
|
const { state, dispatch } = view;
|
|
@@ -26239,8 +26483,144 @@ const processPasteEvent = (view, event, slice) => {
|
|
|
26239
26483
|
dispatch(tr);
|
|
26240
26484
|
return true;
|
|
26241
26485
|
}
|
|
26242
|
-
return
|
|
26486
|
+
return files.length > 0;
|
|
26487
|
+
};
|
|
26488
|
+
|
|
26489
|
+
const MIN_WIDTH = 10;
|
|
26490
|
+
const createImageViewPlugin = (language) => {
|
|
26491
|
+
return new Plugin({
|
|
26492
|
+
props: {
|
|
26493
|
+
nodeViews: {
|
|
26494
|
+
image: (node, view, getPos) => {
|
|
26495
|
+
return new ImageView(node, view, getPos, language);
|
|
26496
|
+
},
|
|
26497
|
+
},
|
|
26498
|
+
},
|
|
26499
|
+
});
|
|
26243
26500
|
};
|
|
26501
|
+
class ImageView {
|
|
26502
|
+
constructor(node, view, getPos, language) {
|
|
26503
|
+
this.createResizeHandle = (position) => {
|
|
26504
|
+
const handle = document.createElement('div');
|
|
26505
|
+
handle.className = `resize-handle ${position}`;
|
|
26506
|
+
handle.setAttribute('role', 'slider');
|
|
26507
|
+
handle.setAttribute('aria-label', translate$1.get('editor-image-view.resize-handle', this.language));
|
|
26508
|
+
handle.setAttribute('tabindex', '0');
|
|
26509
|
+
handle.setAttribute('aria-valuemin', MIN_WIDTH.toString());
|
|
26510
|
+
handle.setAttribute('aria-valuenow', this.img.offsetWidth.toString());
|
|
26511
|
+
handle.setAttribute('aria-valuetext', `${this.img.offsetWidth} pixels`);
|
|
26512
|
+
handle.setAttribute('aria-grabbed', 'false');
|
|
26513
|
+
handle.addEventListener('pointerdown', (e) => {
|
|
26514
|
+
handle.setAttribute('aria-grabbed', 'true');
|
|
26515
|
+
this.onResizeStart(e, position);
|
|
26516
|
+
});
|
|
26517
|
+
return handle;
|
|
26518
|
+
};
|
|
26519
|
+
this.onResizeStart = (event, position) => {
|
|
26520
|
+
event.preventDefault();
|
|
26521
|
+
const handle = event.target;
|
|
26522
|
+
const startX = event.clientX;
|
|
26523
|
+
const startWidth = this.img.offsetWidth;
|
|
26524
|
+
const onPointerMove = (e) => {
|
|
26525
|
+
const delta = e.clientX - startX;
|
|
26526
|
+
const widthDelta = position === 'top-left' ? -delta : delta;
|
|
26527
|
+
const newWidth = Math.max(MIN_WIDTH, startWidth + widthDelta);
|
|
26528
|
+
this.img.style.width = `${newWidth}px`;
|
|
26529
|
+
const handles = this.dom.querySelectorAll('.resize-handle');
|
|
26530
|
+
handles.forEach((resizeHandle) => {
|
|
26531
|
+
resizeHandle.setAttribute('aria-valuenow', newWidth.toString());
|
|
26532
|
+
resizeHandle.setAttribute('aria-valuetext', `${newWidth} pixels`);
|
|
26533
|
+
});
|
|
26534
|
+
};
|
|
26535
|
+
const onPointerUp = () => {
|
|
26536
|
+
window.removeEventListener('pointermove', onPointerMove);
|
|
26537
|
+
window.removeEventListener('pointerup', onPointerUp);
|
|
26538
|
+
handle.setAttribute('aria-grabbed', 'false');
|
|
26539
|
+
this.view.dispatch(this.view.state.tr.setNodeMarkup(this.getPos(), undefined, Object.assign(Object.assign({}, this.node.attrs), { width: this.img.style.width, height: this.node.attrs.height })));
|
|
26540
|
+
};
|
|
26541
|
+
window.addEventListener('pointermove', onPointerMove);
|
|
26542
|
+
window.addEventListener('pointerup', onPointerUp);
|
|
26543
|
+
};
|
|
26544
|
+
this.createLoadingState = () => {
|
|
26545
|
+
this.dom.setAttribute('aria-live', 'polite');
|
|
26546
|
+
this.dom.setAttribute('aria-busy', 'true');
|
|
26547
|
+
this.dom.setAttribute('aria-label', translate$1.get('editor-image-view.loading', this.language, {
|
|
26548
|
+
filename: this.node.attrs.alt || 'file',
|
|
26549
|
+
}));
|
|
26550
|
+
const spinnerElement = document.createElement('limel-linear-progress');
|
|
26551
|
+
spinnerElement.setAttribute('indeterminate', 'true');
|
|
26552
|
+
this.dom.appendChild(spinnerElement);
|
|
26553
|
+
};
|
|
26554
|
+
this.createSuccessState = () => {
|
|
26555
|
+
this.dom.setAttribute('aria-live', 'polite');
|
|
26556
|
+
this.dom.setAttribute('aria-busy', 'false');
|
|
26557
|
+
this.dom.setAttribute('aria-label', translate$1.get('editor-image-view.success', this.language, {
|
|
26558
|
+
filename: this.node.attrs.alt || 'file',
|
|
26559
|
+
}));
|
|
26560
|
+
const bottomRightHandle = this.createResizeHandle('bottom-right');
|
|
26561
|
+
const topLeftHandle = this.createResizeHandle('top-left');
|
|
26562
|
+
this.dom.appendChild(bottomRightHandle);
|
|
26563
|
+
this.dom.appendChild(topLeftHandle);
|
|
26564
|
+
};
|
|
26565
|
+
this.createFailedState = () => {
|
|
26566
|
+
this.dom.setAttribute('aria-live', 'assertive');
|
|
26567
|
+
this.dom.setAttribute('aria-busy', 'false');
|
|
26568
|
+
this.dom.setAttribute('aria-label', translate$1.get('editor-image-view.failed', this.language, {
|
|
26569
|
+
filename: this.node.attrs.alt || 'file',
|
|
26570
|
+
}));
|
|
26571
|
+
};
|
|
26572
|
+
this.cleanUpPreviousState = () => {
|
|
26573
|
+
Array.from(this.dom.childNodes).forEach((child) => {
|
|
26574
|
+
if (!(child instanceof HTMLImageElement)) {
|
|
26575
|
+
child.remove();
|
|
26576
|
+
}
|
|
26577
|
+
});
|
|
26578
|
+
};
|
|
26579
|
+
this.transitionBetweenStates = () => {
|
|
26580
|
+
this.cleanUpPreviousState();
|
|
26581
|
+
this.dom.className = `image-wrapper state-${this.node.attrs.state}`;
|
|
26582
|
+
if (this.node.attrs.state === ImageState.LOADING) {
|
|
26583
|
+
this.createLoadingState();
|
|
26584
|
+
}
|
|
26585
|
+
else if (this.node.attrs.state === ImageState.SUCCESS) {
|
|
26586
|
+
this.createSuccessState();
|
|
26587
|
+
}
|
|
26588
|
+
else if (this.node.attrs.state === ImageState.FAILED) {
|
|
26589
|
+
this.createFailedState();
|
|
26590
|
+
}
|
|
26591
|
+
};
|
|
26592
|
+
this.transitioningBetweenSuccessStates = (newNode) => {
|
|
26593
|
+
return (this.node.attrs.state === ImageState.SUCCESS &&
|
|
26594
|
+
newNode.attrs.state === ImageState.SUCCESS);
|
|
26595
|
+
};
|
|
26596
|
+
this.node = node;
|
|
26597
|
+
this.view = view;
|
|
26598
|
+
this.getPos = getPos;
|
|
26599
|
+
this.language = language;
|
|
26600
|
+
this.dom = document.createElement('div');
|
|
26601
|
+
this.dom.className = `image-wrapper state-${node.attrs.state}`;
|
|
26602
|
+
this.img = document.createElement('img');
|
|
26603
|
+
this.img.src = node.attrs.src;
|
|
26604
|
+
this.img.alt = node.attrs.alt;
|
|
26605
|
+
this.img.style.maxWidth = node.attrs.maxWidth;
|
|
26606
|
+
this.img.style.width = node.attrs.width;
|
|
26607
|
+
this.dom.appendChild(this.img);
|
|
26608
|
+
this.transitionBetweenStates();
|
|
26609
|
+
}
|
|
26610
|
+
// Ensure that the existing NodeView is reused rather than recreated.
|
|
26611
|
+
// Recreating the NodeView will cause flickering between states.
|
|
26612
|
+
update(node) {
|
|
26613
|
+
if (!this.transitioningBetweenSuccessStates(node)) {
|
|
26614
|
+
this.img.src = node.attrs.src;
|
|
26615
|
+
this.img.alt = node.attrs.alt;
|
|
26616
|
+
this.img.style.maxWidth = node.attrs.maxWidth;
|
|
26617
|
+
this.img.style.width = node.attrs.width;
|
|
26618
|
+
}
|
|
26619
|
+
this.node = node;
|
|
26620
|
+
this.transitionBetweenStates();
|
|
26621
|
+
return true;
|
|
26622
|
+
}
|
|
26623
|
+
}
|
|
26244
26624
|
|
|
26245
26625
|
const actionBarPluginKey = new PluginKey('actionBarPlugin');
|
|
26246
26626
|
const getMenuItemStates = (menuTypes, menuCommandFactory, view) => {
|
|
@@ -27932,13 +28312,15 @@ const getTableNodes = () => {
|
|
|
27932
28312
|
});
|
|
27933
28313
|
};
|
|
27934
28314
|
|
|
27935
|
-
const prosemirrorAdapterCss = "@charset \"UTF-8\";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}: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{caret-color:transparent}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background: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}blockquote{position:relative;font-weight:100;font-size:0.875rem;max-width:100%;line-height:1.4;margin:0;padding:0.5rem 1.25rem;border-radius:0.05rem 0.75rem;background-color:rgb(var(--contrast-300))}blockquote:before,blockquote:after{position:absolute;font-size:2.75rem;opacity:0.4}blockquote:before{content:\"“\";left:0;top:-0.75rem}blockquote:after{content:\"”\";right:0;bottom:-2rem}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:0.875rem;word-break:break-word;hyphens:auto;-webkit-hyphens:auto}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:only-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:0.875rem;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:0.875rem}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}: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{position:relative;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{margin-bottom:0.25rem}code{font-family:ui-monospace, \"Cascadia Code\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace;font-size:0.8125rem;letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none;display:inline-block;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;overflow:auto;white-space:pre-wrap}: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:0.875rem}: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{font-family:ui-monospace, \"Cascadia Code\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace;font-weight:600;color:rgb(var(--contrast-1100));background-color:rgb(var(--contrast-200));white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;padding:0.125rem 0.5rem;margin:0 0.25rem;box-shadow:var(--button-shadow-normal), 0 0.03125rem 0.21875rem 0 rgba(var(--contrast-100), 0.5) inset;border-radius:0.125rem;border-style:solid;border-color:rgba(var(--contrast-600), 0.8);border-width:0 1px 0.125rem 1px}img{max-width:100%;border-radius:0.25rem}";
|
|
28315
|
+
const prosemirrorAdapterCss = "@charset \"UTF-8\";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}: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{caret-color:transparent}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background: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}blockquote{position:relative;font-weight:100;font-size:0.875rem;max-width:100%;line-height:1.4;margin:0;padding:0.5rem 1.25rem;border-radius:0.05rem 0.75rem;background-color:rgb(var(--contrast-300))}blockquote:before,blockquote:after{position:absolute;font-size:2.75rem;opacity:0.4}blockquote:before{content:\"“\";left:0;top:-0.75rem}blockquote:after{content:\"”\";right:0;bottom:-2rem}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:0.875rem;word-break:break-word;hyphens:auto;-webkit-hyphens:auto}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:only-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:0.875rem;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:0.875rem}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}: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{position:relative;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{margin-bottom:0.25rem}code{font-family:ui-monospace, \"Cascadia Code\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace;font-size:0.8125rem;letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none;display:inline-block;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;overflow:auto;white-space:pre-wrap}: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:0.875rem}: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{font-family:ui-monospace, \"Cascadia Code\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace;font-weight:600;color:rgb(var(--contrast-1100));background-color:rgb(var(--contrast-200));white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;padding:0.125rem 0.5rem;margin:0 0.25rem;box-shadow:var(--button-shadow-normal), 0 0.03125rem 0.21875rem 0 rgba(var(--contrast-100), 0.5) inset;border-radius:0.125rem;border-style:solid;border-color:rgba(var(--contrast-600), 0.8);border-width:0 1px 0.125rem 1px}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:url(\"data:image/svg+xml;charset=utf-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' style='fill-rule:evenodd;'><path fill='rgba(186,186,192,0.16)' d='M0 0h4v4H0zM4 4h4v4H4z'/></svg>\");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(--mdc-theme-primary);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(--mdc-theme-on-surface);background-color:rgb(var(--contrast-900));box-shadow:var(--button-shadow-normal);cursor:nwse-resize;position:absolute;display:flex;align-items:center;justify-content:center;width:0.5rem;height:0.5rem;border-radius:50%;opacity:0.6}.resize-handle:hover,.resize-handle:focus,.resize-handle:focus-visible{will-change:color, background-color, box-shadow, transform}.resize-handle:hover{transform:translate3d(0, -0.04rem, 0);color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}.resize-handle:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );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.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-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(--mdc-theme-primary)}.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))}";
|
|
27936
28316
|
|
|
27937
28317
|
const DEBOUNCE_TIMEOUT = 300;
|
|
27938
28318
|
const ProsemirrorAdapter = class {
|
|
27939
28319
|
constructor(hostRef) {
|
|
27940
28320
|
registerInstance(this, hostRef);
|
|
27941
28321
|
this.change = createEvent(this, "change", 7);
|
|
28322
|
+
this.imagePasted = createEvent(this, "imagePasted", 7);
|
|
28323
|
+
this.imageRemoved = createEvent(this, "imageRemoved", 7);
|
|
27942
28324
|
this.changeWaiting = false;
|
|
27943
28325
|
/**
|
|
27944
28326
|
* Used to stop change event emitting as result of getting updated value from consumer
|
|
@@ -28084,6 +28466,7 @@ const ProsemirrorAdapter = class {
|
|
|
28084
28466
|
}
|
|
28085
28467
|
disconnectedCallback() {
|
|
28086
28468
|
var _a, _b, _c;
|
|
28469
|
+
imageCache.clear();
|
|
28087
28470
|
this.host.removeEventListener('open-editor-link-menu', this.handleOpenLinkMenu);
|
|
28088
28471
|
(_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.removeEventListener('blur', this.handleBlur);
|
|
28089
28472
|
(_c = this.view) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
@@ -28099,7 +28482,7 @@ const ProsemirrorAdapter = class {
|
|
|
28099
28482
|
}
|
|
28100
28483
|
setupContentConverter() {
|
|
28101
28484
|
if (this.contentType === 'markdown') {
|
|
28102
|
-
this.contentConverter = new MarkdownConverter(this.customElements);
|
|
28485
|
+
this.contentConverter = new MarkdownConverter(this.customElements, this.language);
|
|
28103
28486
|
}
|
|
28104
28487
|
else if (this.contentType === 'html') {
|
|
28105
28488
|
this.contentConverter = new HTMLConverter(this.customElements);
|
|
@@ -28132,6 +28515,7 @@ const ProsemirrorAdapter = class {
|
|
|
28132
28515
|
if (this.contentType === 'html') {
|
|
28133
28516
|
nodes = nodes.append(getTableNodes());
|
|
28134
28517
|
}
|
|
28518
|
+
nodes = nodes.append(getImageNode(this.language));
|
|
28135
28519
|
return new Schema({
|
|
28136
28520
|
nodes: nodes,
|
|
28137
28521
|
marks: schema$1.spec.marks.append({
|
|
@@ -28158,7 +28542,8 @@ const ProsemirrorAdapter = class {
|
|
|
28158
28542
|
keymap(this.menuCommandFactory.buildKeymap()),
|
|
28159
28543
|
createTriggerPlugin(this.triggerCharacters, this.contentConverter),
|
|
28160
28544
|
createLinkPlugin(this.handleNewLinkSelection),
|
|
28161
|
-
|
|
28545
|
+
createImageInserterPlugin(this.imagePasted.emit, this.imageRemoved.emit),
|
|
28546
|
+
createImageViewPlugin(this.language),
|
|
28162
28547
|
createMenuStateTrackingPlugin(editorMenuTypesArray, this.menuCommandFactory, this.updateActiveActionBarItems),
|
|
28163
28548
|
createActionBarInteractionPlugin(this.menuCommandFactory),
|
|
28164
28549
|
...getTableEditingPlugins(this.contentType === 'html'),
|