@limetech/lime-elements 37.44.3 → 37.45.1
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 +23 -0
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +143 -17
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-commands.js +81 -10
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-commands.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-items.js +27 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-items.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-schema-extender.js +12 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-schema-extender.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/types.js +3 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/types.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +16 -7
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/text-editor/text-editor.js.map +1 -1
- package/dist/collection/components/text-editor/utils/markdown-converter.js +8 -2
- package/dist/collection/components/text-editor/utils/markdown-converter.js.map +1 -1
- package/dist/collection/util/get-attributes.js +27 -0
- package/dist/collection/util/get-attributes.js.map +1 -0
- package/dist/esm/limel-prosemirror-adapter.entry.js +143 -17
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/limel-text-editor.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-50a34fa3.entry.js → p-3ae3b23e.entry.js} +2 -2
- package/dist/lime-elements/p-3ae3b23e.entry.js.map +1 -0
- package/dist/lime-elements/p-c5f96fcd.entry.js.map +1 -1
- package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-commands.d.ts +9 -6
- package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-items.d.ts +3 -0
- package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-schema-extender.d.ts +3 -0
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +1 -0
- package/dist/types/util/get-attributes.d.ts +15 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-50a34fa3.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-converter.js","sourceRoot":"","sources":["../../../../src/components/text-editor/utils/markdown-converter.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"markdown-converter.js","sourceRoot":"","sources":["../../../../src/components/text-editor/utils/markdown-converter.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,kBAAkB,EAClB,yBAAyB,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,MAAM,wBAAwB,GAAG,IAAI,kBAAkB,mBAE5C,yBAAyB,CAAC,KAAK,mCAG/B,yBAAyB,CAAC,KAAK,KAClC,aAAa,EAAE;IACX,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,wBAAwB,EAAE,IAAI;GACjC,IAER,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,iBAAiB;EAA9B;IACW,gBAAW,GAAG,CAAC,IAAY,EAAmB,EAAE;MACnD,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC;IAEK,cAAS,GAAG,CAAC,IAAgB,EAAU,EAAE;MAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,EAAE;QAC7B,OAAO,EAAE,CAAC;OACb;WAAM;QACH,OAAO,wBAAwB,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;OAC7D;IACL,CAAC,CAAC;EACN,CAAC;CAAA","sourcesContent":["import { ContentTypeConverter } from './content-type-converter';\nimport { EditorView } from 'prosemirror-view';\nimport {\n MarkdownSerializer,\n defaultMarkdownSerializer,\n} from 'prosemirror-markdown';\nimport { markdownToHTML } from '../../markdown/markdown-parser';\n\nconst customMarkdownSerializer = new MarkdownSerializer(\n {\n ...defaultMarkdownSerializer.nodes,\n },\n {\n ...defaultMarkdownSerializer.marks,\n strikethrough: {\n open: '~~',\n close: '~~',\n mixable: true,\n expelEnclosingWhitespace: true,\n },\n },\n);\n\n/**\n * @private\n */\nexport class markdownConverter implements ContentTypeConverter {\n public parseAsHTML = (text: string): Promise<string> => {\n return markdownToHTML(text);\n };\n\n public serialize = (view: EditorView): string => {\n if (view.dom.textContent === '') {\n return '';\n } else {\n return customMarkdownSerializer.serialize(view.state.doc);\n }\n };\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Some attributes are randomly generated and we do not have access to them as they
|
|
3
|
+
* are generated e.g., inside the breadcrumbs component. But we can get them this way.
|
|
4
|
+
* Retrieves such attributes as ids via inorder traversal
|
|
5
|
+
*
|
|
6
|
+
* Useful for testing
|
|
7
|
+
*
|
|
8
|
+
* @param node - base node
|
|
9
|
+
* @param attributes - array that you wish to populate that contains the found attributes
|
|
10
|
+
* @param attribute - the name of the type of attribute you are looking for
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export function getAttributesRecursively(node, attributes, attribute = 'id') {
|
|
15
|
+
if (node.children && node.getAttribute(attribute)) {
|
|
16
|
+
attributes.push(node.getAttribute(attribute));
|
|
17
|
+
}
|
|
18
|
+
if (node.shadowRoot) {
|
|
19
|
+
for (const child of Array.from(node.shadowRoot.children)) {
|
|
20
|
+
getAttributesRecursively(child, attributes, attribute);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
for (const child of Array.from(node.children)) {
|
|
24
|
+
getAttributesRecursively(child, attributes, attribute);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=get-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-attributes.js","sourceRoot":"","sources":["../../src/util/get-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CACpC,IAAa,EACb,UAAoB,EACpB,YAAoB,IAAI;EAExB,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;IAC/C,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;GACjD;EAED,IAAI,IAAI,CAAC,UAAU,EAAE;IACjB,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;MACtD,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;KAC1D;GACJ;EAED,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;IAC3C,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;GAC1D;AACL,CAAC","sourcesContent":["/**\n * Some attributes are randomly generated and we do not have access to them as they\n * are generated e.g., inside the breadcrumbs component. But we can get them this way.\n * Retrieves such attributes as ids via inorder traversal\n *\n * Useful for testing\n *\n * @param node - base node\n * @param attributes - array that you wish to populate that contains the found attributes\n * @param attribute - the name of the type of attribute you are looking for\n *\n * @internal\n */\nexport function getAttributesRecursively(\n node: Element,\n attributes: string[],\n attribute: string = 'id',\n) {\n if (node.children && node.getAttribute(attribute)) {\n attributes.push(node.getAttribute(attribute));\n }\n\n if (node.shadowRoot) {\n for (const child of Array.from(node.shadowRoot.children)) {\n getAttributesRecursively(child, attributes, attribute);\n }\n }\n\n for (const child of Array.from(node.children)) {\n getAttributesRecursively(child, attributes, attribute);\n }\n}\n"]}
|
|
@@ -16538,6 +16538,9 @@ const EditorMenuTypes = {
|
|
|
16538
16538
|
Link: 'link',
|
|
16539
16539
|
OrderedList: 'ordered_list',
|
|
16540
16540
|
BulletList: 'bullet_list',
|
|
16541
|
+
Strikethrough: 'strikethrough',
|
|
16542
|
+
Code: 'code',
|
|
16543
|
+
CodeBlock: 'code_block',
|
|
16541
16544
|
};
|
|
16542
16545
|
/**
|
|
16543
16546
|
* `LevelMapping` is used to map string identifiers to numerical header levels.
|
|
@@ -16570,7 +16573,7 @@ const setActiveMethodForNode = (command, nodeType, level) => {
|
|
|
16570
16573
|
const { $from } = state.selection;
|
|
16571
16574
|
const node = $from.node($from.depth);
|
|
16572
16575
|
if (node && node.type.name === nodeType.name) {
|
|
16573
|
-
if (nodeType.name ===
|
|
16576
|
+
if (nodeType.name === LevelMapping.Heading && level) {
|
|
16574
16577
|
return node.attrs.level === level;
|
|
16575
16578
|
}
|
|
16576
16579
|
return true;
|
|
@@ -16615,14 +16618,44 @@ const getAttributes = (markName, url) => {
|
|
|
16615
16618
|
const isExternalLink = (url) => {
|
|
16616
16619
|
return !url.startsWith(window.location.origin);
|
|
16617
16620
|
};
|
|
16621
|
+
const toggleBlockType = (schema, type, attrs = {}, wrap = false) => {
|
|
16622
|
+
const blockType = schema.nodes[type];
|
|
16623
|
+
const paragraphType = schema.nodes.paragraph;
|
|
16624
|
+
return (state, dispatch) => {
|
|
16625
|
+
const { $from, to } = state.selection;
|
|
16626
|
+
if (state.selection instanceof TextSelection &&
|
|
16627
|
+
$from.sameParent($from.doc.resolve(to))) {
|
|
16628
|
+
if ($from.parent.type === blockType) {
|
|
16629
|
+
if (dispatch) {
|
|
16630
|
+
dispatch(state.tr.setBlockType($from.pos, to, paragraphType));
|
|
16631
|
+
}
|
|
16632
|
+
return true;
|
|
16633
|
+
}
|
|
16634
|
+
else {
|
|
16635
|
+
if (wrap) {
|
|
16636
|
+
return wrapIn(blockType, attrs)(state, dispatch);
|
|
16637
|
+
}
|
|
16638
|
+
else {
|
|
16639
|
+
return setBlockType(blockType, attrs)(state, dispatch);
|
|
16640
|
+
}
|
|
16641
|
+
}
|
|
16642
|
+
}
|
|
16643
|
+
return false;
|
|
16644
|
+
};
|
|
16645
|
+
};
|
|
16618
16646
|
const createSetNodeTypeCommand = (schema, nodeType, level) => {
|
|
16619
16647
|
const type = schema.nodes[nodeType];
|
|
16620
16648
|
if (!type) {
|
|
16621
16649
|
throw new Error(`Node type "${nodeType}" not found in schema`);
|
|
16622
16650
|
}
|
|
16623
16651
|
let command;
|
|
16624
|
-
if (nodeType ===
|
|
16625
|
-
command =
|
|
16652
|
+
if (nodeType === LevelMapping.Heading && level) {
|
|
16653
|
+
command = toggleBlockType(schema, LevelMapping.Heading, {
|
|
16654
|
+
level: level,
|
|
16655
|
+
});
|
|
16656
|
+
}
|
|
16657
|
+
else if (nodeType === EditorMenuTypes.CodeBlock) {
|
|
16658
|
+
command = toggleBlockType(schema, EditorMenuTypes.CodeBlock);
|
|
16626
16659
|
}
|
|
16627
16660
|
else {
|
|
16628
16661
|
command = setBlockType(type);
|
|
@@ -16635,16 +16668,50 @@ const createWrapInCommand = (schema, nodeType) => {
|
|
|
16635
16668
|
if (!type) {
|
|
16636
16669
|
throw new Error(`Node type "${nodeType}" not found in schema`);
|
|
16637
16670
|
}
|
|
16638
|
-
|
|
16671
|
+
let command;
|
|
16672
|
+
if (nodeType === EditorMenuTypes.Blockquote) {
|
|
16673
|
+
command = toggleBlockType(schema, EditorMenuTypes.Blockquote, {}, true);
|
|
16674
|
+
}
|
|
16675
|
+
else {
|
|
16676
|
+
command = wrapIn(type);
|
|
16677
|
+
}
|
|
16639
16678
|
setActiveMethodForWrap(command, type);
|
|
16640
16679
|
return command;
|
|
16641
16680
|
};
|
|
16681
|
+
const toggleList = (listType) => {
|
|
16682
|
+
return (state, dispatch) => {
|
|
16683
|
+
const { $from, $to } = state.selection;
|
|
16684
|
+
const range = $from.blockRange($to);
|
|
16685
|
+
if (!range) {
|
|
16686
|
+
return false;
|
|
16687
|
+
}
|
|
16688
|
+
const wrapping = range && findWrapping(range, listType);
|
|
16689
|
+
if (wrapping) {
|
|
16690
|
+
// Wrap the selection in a list
|
|
16691
|
+
if (dispatch) {
|
|
16692
|
+
dispatch(state.tr.wrap(range, wrapping).scrollIntoView());
|
|
16693
|
+
}
|
|
16694
|
+
return true;
|
|
16695
|
+
}
|
|
16696
|
+
else {
|
|
16697
|
+
// Check if we are in a list item and lift out of the list
|
|
16698
|
+
const liftRange = range && liftTarget(range);
|
|
16699
|
+
if (liftRange !== null) {
|
|
16700
|
+
if (dispatch) {
|
|
16701
|
+
dispatch(state.tr.lift(range, liftRange).scrollIntoView());
|
|
16702
|
+
}
|
|
16703
|
+
return true;
|
|
16704
|
+
}
|
|
16705
|
+
return false;
|
|
16706
|
+
}
|
|
16707
|
+
};
|
|
16708
|
+
};
|
|
16642
16709
|
const createListCommand = (schema, listType) => {
|
|
16643
16710
|
const type = schema.nodes[listType];
|
|
16644
16711
|
if (!type) {
|
|
16645
16712
|
throw new Error(`List type "${listType}" not found in schema`);
|
|
16646
16713
|
}
|
|
16647
|
-
const command =
|
|
16714
|
+
const command = toggleList(type);
|
|
16648
16715
|
setActiveMethodForWrap(command, type);
|
|
16649
16716
|
return command;
|
|
16650
16717
|
};
|
|
@@ -16652,15 +16719,18 @@ const commandMapping = {
|
|
|
16652
16719
|
strong: createToggleMarkCommand,
|
|
16653
16720
|
em: createToggleMarkCommand,
|
|
16654
16721
|
underline: createToggleMarkCommand,
|
|
16722
|
+
strikethrough: createToggleMarkCommand,
|
|
16723
|
+
code: createToggleMarkCommand,
|
|
16724
|
+
link: createToggleMarkCommand,
|
|
16655
16725
|
headerlevel1: (schema) => createSetNodeTypeCommand(schema, LevelMapping.Heading, LevelMapping.one),
|
|
16656
16726
|
headerlevel2: (schema) => createSetNodeTypeCommand(schema, LevelMapping.Heading, LevelMapping.two),
|
|
16657
16727
|
headerlevel3: (schema) => createSetNodeTypeCommand(schema, LevelMapping.Heading, LevelMapping.three),
|
|
16658
|
-
blockquote: createWrapInCommand,
|
|
16728
|
+
blockquote: (schema) => createWrapInCommand(schema, EditorMenuTypes.Blockquote),
|
|
16659
16729
|
/* eslint-disable camelcase */
|
|
16660
|
-
|
|
16661
|
-
|
|
16730
|
+
code_block: (schema) => createSetNodeTypeCommand(schema, EditorMenuTypes.CodeBlock),
|
|
16731
|
+
ordered_list: (schema) => createListCommand(schema, EditorMenuTypes.OrderedList),
|
|
16732
|
+
bullet_list: (schema) => createListCommand(schema, EditorMenuTypes.BulletList),
|
|
16662
16733
|
/* eslint-enable camelcase */
|
|
16663
|
-
link: createToggleMarkCommand,
|
|
16664
16734
|
};
|
|
16665
16735
|
class MenuCommandFactory {
|
|
16666
16736
|
constructor(schema) {
|
|
@@ -16680,6 +16750,9 @@ class MenuCommandFactory {
|
|
|
16680
16750
|
'Mod-Shift-1': this.getCommand(EditorMenuTypes.HeaderLevel1),
|
|
16681
16751
|
'Mod-Shift-2': this.getCommand(EditorMenuTypes.HeaderLevel2),
|
|
16682
16752
|
'Mod-Shift-3': this.getCommand(EditorMenuTypes.HeaderLevel3),
|
|
16753
|
+
'Mod-Shift-X': this.getCommand(EditorMenuTypes.Strikethrough),
|
|
16754
|
+
'Mod-`': this.getCommand(EditorMenuTypes.Code),
|
|
16755
|
+
'Mod-Shift-C': this.getCommand(EditorMenuTypes.CodeBlock),
|
|
16683
16756
|
};
|
|
16684
16757
|
}
|
|
16685
16758
|
}
|
|
@@ -16709,6 +16782,30 @@ const textEditorMenuItems = [
|
|
|
16709
16782
|
iconOnly: true,
|
|
16710
16783
|
selected: false,
|
|
16711
16784
|
},
|
|
16785
|
+
{
|
|
16786
|
+
value: EditorMenuTypes.Strikethrough,
|
|
16787
|
+
text: 'Strikethrough',
|
|
16788
|
+
commandText: `${mod} ${shift} X`,
|
|
16789
|
+
icon: '-lime-text-strikethrough',
|
|
16790
|
+
iconOnly: true,
|
|
16791
|
+
selected: false,
|
|
16792
|
+
},
|
|
16793
|
+
{
|
|
16794
|
+
value: EditorMenuTypes.Code,
|
|
16795
|
+
text: 'Code',
|
|
16796
|
+
commandText: `${mod} \``,
|
|
16797
|
+
icon: '-lime-text-code',
|
|
16798
|
+
iconOnly: true,
|
|
16799
|
+
selected: false,
|
|
16800
|
+
},
|
|
16801
|
+
{
|
|
16802
|
+
value: EditorMenuTypes.CodeBlock,
|
|
16803
|
+
text: 'Code Block',
|
|
16804
|
+
commandText: `${mod} ${shift} C`,
|
|
16805
|
+
icon: '-lime-text-code-block',
|
|
16806
|
+
iconOnly: true,
|
|
16807
|
+
selected: false,
|
|
16808
|
+
},
|
|
16712
16809
|
{ separator: true },
|
|
16713
16810
|
{
|
|
16714
16811
|
value: EditorMenuTypes.HeaderLevel1,
|
|
@@ -16767,9 +16864,12 @@ const menuTranslationIDs = {
|
|
|
16767
16864
|
/* eslint-disable camelcase */
|
|
16768
16865
|
bullet_list: 'editor-menu.bulleted-list',
|
|
16769
16866
|
ordered_list: 'editor-menu.numbered-list',
|
|
16867
|
+
code_block: 'editor-menu.code-block',
|
|
16770
16868
|
/* eslint-enable camelcase */
|
|
16771
16869
|
blockquote: 'editor-menu.blockquote',
|
|
16772
16870
|
link: 'editor-menu.link',
|
|
16871
|
+
strikethrough: 'editor-menu.strikethrough',
|
|
16872
|
+
code: 'editor-menu.code',
|
|
16773
16873
|
};
|
|
16774
16874
|
|
|
16775
16875
|
/* eslint-disable no-bitwise */
|
|
@@ -25392,6 +25492,12 @@ class MarkdownSerializerState {
|
|
|
25392
25492
|
}
|
|
25393
25493
|
}
|
|
25394
25494
|
|
|
25495
|
+
const customMarkdownSerializer = new MarkdownSerializer(Object.assign({}, defaultMarkdownSerializer.nodes), Object.assign(Object.assign({}, defaultMarkdownSerializer.marks), { strikethrough: {
|
|
25496
|
+
open: '~~',
|
|
25497
|
+
close: '~~',
|
|
25498
|
+
mixable: true,
|
|
25499
|
+
expelEnclosingWhitespace: true,
|
|
25500
|
+
} }));
|
|
25395
25501
|
/**
|
|
25396
25502
|
* @private
|
|
25397
25503
|
*/
|
|
@@ -25405,7 +25511,7 @@ class markdownConverter {
|
|
|
25405
25511
|
return '';
|
|
25406
25512
|
}
|
|
25407
25513
|
else {
|
|
25408
|
-
return
|
|
25514
|
+
return customMarkdownSerializer.serialize(view.state.doc);
|
|
25409
25515
|
}
|
|
25410
25516
|
};
|
|
25411
25517
|
}
|
|
@@ -25432,6 +25538,18 @@ class HTMLConverter {
|
|
|
25432
25538
|
}
|
|
25433
25539
|
}
|
|
25434
25540
|
|
|
25541
|
+
const strikethrough = {
|
|
25542
|
+
parseDOM: [
|
|
25543
|
+
{ tag: 's' },
|
|
25544
|
+
{ tag: 'del' },
|
|
25545
|
+
{ tag: 'strike' },
|
|
25546
|
+
{ style: 'text-decoration=line-through' },
|
|
25547
|
+
],
|
|
25548
|
+
toDOM: () => {
|
|
25549
|
+
return ['s', 0];
|
|
25550
|
+
},
|
|
25551
|
+
};
|
|
25552
|
+
|
|
25435
25553
|
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) limel-action-bar{order:1}:host(limel-prosemirror-adapter) div#editor{order:2;height:100%}:host(limel-prosemirror-adapter) div[contenteditable=true]{height:100%}*{box-sizing:border-box}.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}limel-action-bar{--action-bar-border-radius:0.25rem;position:sticky;z-index:1;top:1px;background-color:rgba(var(--contrast-200), 0.5);backdrop-filter:blur(0.5rem);-webkit-backdrop-filter:blur(0.5rem);opacity:0.6;transition:opacity 0.5s ease;margin:0 1px;width:calc(100% - 2px)}:host(limel-prosemirror-adapter:focus-within) limel-action-bar,:host(limel-prosemirror-adapter:hover) limel-action-bar{opacity:1}.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}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;border:1px solid rgb(var(--contrast-400))}: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))}";
|
|
25436
25554
|
|
|
25437
25555
|
const ProsemirrorAdapter = class {
|
|
@@ -25524,13 +25642,19 @@ const ProsemirrorAdapter = class {
|
|
|
25524
25642
|
h("limel-action-bar", { accessibleLabel: "Toolbar", actions: this.actionBarItems, onItemSelected: this.handleActionBarItem }),
|
|
25525
25643
|
];
|
|
25526
25644
|
}
|
|
25645
|
+
disconnectedCallback() {
|
|
25646
|
+
this.view.destroy();
|
|
25647
|
+
}
|
|
25527
25648
|
setupContentConverter() {
|
|
25528
|
-
|
|
25529
|
-
|
|
25530
|
-
|
|
25531
|
-
|
|
25532
|
-
|
|
25533
|
-
|
|
25649
|
+
if (this.contentType === 'markdown') {
|
|
25650
|
+
this.contentConverter = new markdownConverter();
|
|
25651
|
+
}
|
|
25652
|
+
else if (this.contentType === 'html') {
|
|
25653
|
+
this.contentConverter = new HTMLConverter();
|
|
25654
|
+
}
|
|
25655
|
+
else {
|
|
25656
|
+
throw new Error(`Unsupported content type: ${this.contentType}. Only 'markdown' and 'html' are supported.`);
|
|
25657
|
+
}
|
|
25534
25658
|
}
|
|
25535
25659
|
async initializeTextEditor() {
|
|
25536
25660
|
this.schema = this.initializeSchema();
|
|
@@ -25547,7 +25671,9 @@ const ProsemirrorAdapter = class {
|
|
|
25547
25671
|
initializeSchema() {
|
|
25548
25672
|
return new Schema({
|
|
25549
25673
|
nodes: addListNodes(schema$1.spec.nodes, 'paragraph block*', 'block'),
|
|
25550
|
-
marks: schema$1.spec.marks
|
|
25674
|
+
marks: schema$1.spec.marks.append({
|
|
25675
|
+
strikethrough: strikethrough,
|
|
25676
|
+
}),
|
|
25551
25677
|
});
|
|
25552
25678
|
}
|
|
25553
25679
|
async parseInitialContent() {
|