@limetech/lime-elements 37.17.3 → 37.18.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 +8 -0
- package/dist/cjs/limel-text-editor.cjs.entry.js +38 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
- package/dist/collection/components/text-editor/menu/default-menu.js +35 -0
- package/dist/collection/components/text-editor/menu/default-menu.js.map +1 -0
- package/dist/collection/components/text-editor/text-editor.js +6 -1
- package/dist/collection/components/text-editor/text-editor.js.map +1 -1
- package/dist/esm/limel-text-editor.entry.js +38 -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-6a0eac83.entry.js → p-7968bfa0.entry.js} +2 -2
- package/dist/lime-elements/p-7968bfa0.entry.js.map +1 -0
- package/dist/types/components/text-editor/menu/default-menu.d.ts +11 -0
- package/package.json +2 -2
- package/dist/lime-elements/p-6a0eac83.entry.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Dropdown, MenuItem } from 'prosemirror-menu';
|
|
2
|
+
import { buildMenuItems } from 'prosemirror-example-setup';
|
|
3
|
+
/**
|
|
4
|
+
* Creates the default menu for the text editor
|
|
5
|
+
* based on the default menu already in prosemirror-example-setup
|
|
6
|
+
* @param schema - the schema to use for the menu
|
|
7
|
+
*
|
|
8
|
+
* @returns the default menu for the text editor
|
|
9
|
+
*/
|
|
10
|
+
export const buildDefaultMenu = (schema) => {
|
|
11
|
+
const menuItems = buildMenuItems(schema);
|
|
12
|
+
const { inlineMenu, insertHorizontalRule } = menuItems;
|
|
13
|
+
const typeMenu = getNewMenu(menuItems.typeMenu);
|
|
14
|
+
const newHorizontalRule = new MenuItem(Object.assign(Object.assign({}, insertHorizontalRule.spec), { label: 'hr' }));
|
|
15
|
+
const historyButtons = menuItems.fullMenu[2];
|
|
16
|
+
const blockMenu = getBlockMenu(menuItems.blockMenu);
|
|
17
|
+
return [
|
|
18
|
+
inlineMenu[0],
|
|
19
|
+
[newHorizontalRule],
|
|
20
|
+
...typeMenu,
|
|
21
|
+
historyButtons,
|
|
22
|
+
blockMenu,
|
|
23
|
+
];
|
|
24
|
+
};
|
|
25
|
+
const getNewMenu = (typeMenu) => {
|
|
26
|
+
const headingDropdown = new Dropdown(typeMenu.content[2].content, {
|
|
27
|
+
label: 'H',
|
|
28
|
+
});
|
|
29
|
+
return [[typeMenu.content[0], typeMenu.content[1]], [headingDropdown]];
|
|
30
|
+
};
|
|
31
|
+
const getBlockMenu = (blockMenu) => {
|
|
32
|
+
// eslint-disable-next-line no-magic-numbers
|
|
33
|
+
return [...blockMenu[0].slice(0, 5)];
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=default-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-menu.js","sourceRoot":"","sources":["../../../../src/components/text-editor/menu/default-menu.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAmB,EAAE;EAChE,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAQtC,CAAC;EACF,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAC;EACvD,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;EAChD,MAAM,iBAAiB,GAAG,IAAI,QAAQ,iCAC/B,oBAAoB,CAAC,IAAI,KAC5B,KAAK,EAAE,IAAI,IACb,CAAC;EACH,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;EAC7C,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;EAEpD,OAAO;IACH,UAAU,CAAC,CAAC,CAAC;IACb,CAAC,iBAAiB,CAAC;IACnB,GAAG,QAAQ;IACX,cAAc;IACd,SAAS;GACZ,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CACf,QAA+C,EAChC,EAAE;EACjB,MAAM,eAAe,GAAa,IAAI,QAAQ,CACzC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAyC,CAAC,OAAO,EACpE;IACI,KAAK,EAAE,GAAG;GACb,CACJ,CAAC;EAEF,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,SAA0B,EAAiB,EAAE;EAC/D,4CAA4C;EAC5C,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC","sourcesContent":["import { Schema } from 'prosemirror-model';\nimport { MenuElement, Dropdown, MenuItem } from 'prosemirror-menu';\nimport { buildMenuItems } from 'prosemirror-example-setup';\n\n/**\n * Creates the default menu for the text editor\n * based on the default menu already in prosemirror-example-setup\n * @param schema - the schema to use for the menu\n *\n * @returns the default menu for the text editor\n */\nexport const buildDefaultMenu = (schema: Schema): MenuElement[][] => {\n const menuItems = buildMenuItems(schema) as unknown as {\n blockMenu: MenuElement[][];\n fullMenu: MenuElement[][];\n inlineMenu: MenuElement[][];\n insertHorizontalRule: MenuItem;\n typeMenu: Dropdown & {\n content: MenuElement[];\n };\n };\n const { inlineMenu, insertHorizontalRule } = menuItems;\n const typeMenu = getNewMenu(menuItems.typeMenu);\n const newHorizontalRule = new MenuItem({\n ...insertHorizontalRule.spec,\n label: 'hr',\n });\n const historyButtons = menuItems.fullMenu[2];\n const blockMenu = getBlockMenu(menuItems.blockMenu);\n\n return [\n inlineMenu[0],\n [newHorizontalRule],\n ...typeMenu,\n historyButtons,\n blockMenu,\n ];\n};\n\nconst getNewMenu = (\n typeMenu: Dropdown & { content: MenuElement[] },\n): MenuElement[][] => {\n const headingDropdown: Dropdown = new Dropdown(\n (typeMenu.content[2] as Partial<{ content: MenuElement[] }>).content,\n {\n label: 'H',\n },\n );\n\n return [[typeMenu.content[0], typeMenu.content[1]], [headingDropdown]];\n};\n\nconst getBlockMenu = (blockMenu: MenuElement[][]): MenuElement[] => {\n // eslint-disable-next-line no-magic-numbers\n return [...blockMenu[0].slice(0, 5)];\n};\n"]}
|
|
@@ -5,6 +5,7 @@ import { Schema, DOMParser } from 'prosemirror-model';
|
|
|
5
5
|
import { schema } from 'prosemirror-schema-basic';
|
|
6
6
|
import { addListNodes } from 'prosemirror-schema-list';
|
|
7
7
|
import { exampleSetup } from 'prosemirror-example-setup';
|
|
8
|
+
import { buildDefaultMenu } from './menu/default-menu';
|
|
8
9
|
/**
|
|
9
10
|
* This editor offers a rich text editing experience with markdown support,
|
|
10
11
|
* in the sense that you can easily type markdown syntax and see the rendered
|
|
@@ -31,10 +32,14 @@ export class TextEditor {
|
|
|
31
32
|
nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'),
|
|
32
33
|
marks: schema.spec.marks,
|
|
33
34
|
});
|
|
35
|
+
const menu = buildDefaultMenu(mySchema);
|
|
34
36
|
this.view = new EditorView(this.host.shadowRoot.querySelector('#editor'), {
|
|
35
37
|
state: EditorState.create({
|
|
36
38
|
doc: DOMParser.fromSchema(mySchema).parse(this.host.shadowRoot.querySelector('#editor')),
|
|
37
|
-
plugins: exampleSetup({
|
|
39
|
+
plugins: exampleSetup({
|
|
40
|
+
schema: mySchema,
|
|
41
|
+
menuContent: menu,
|
|
42
|
+
}),
|
|
38
43
|
}),
|
|
39
44
|
dispatchTransaction: (transaction) => {
|
|
40
45
|
const newState = this.view.state.apply(transa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,CAAC,aAAa,CAAC,SAAS,CAAC,CAChD;QACD,OAAO,EAAE,YAAY,CAAC;UAClB,MAAM,EAAE,QAAQ;UAChB,WAAW,EAAE,IAAoB;SACpC,CAAC;OACL,CAAC;MACF,mBAAmB,EAAE,CAAC,WAAW,EAAE,EAAE;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEhC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;MACxD,CAAC;KACJ,CACJ,CAAC;EACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n State,\n h,\n} from '@stencil/core';\nimport { EditorState } from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\nimport { Schema, DOMParser } from 'prosemirror-model';\nimport { schema } from 'prosemirror-schema-basic';\nimport { addListNodes } from 'prosemirror-schema-list';\nimport { exampleSetup } from 'prosemirror-example-setup';\nimport { MenuElement, MenuItem } from 'prosemirror-menu';\nimport { buildDefaultMenu } from './menu/default-menu';\n\n/**\n * This editor offers a rich text editing experience with markdown support,\n * in the sense that you can easily type markdown syntax and see the rendered\n * result as rich text in real-time. For instance, you can type `# Hello, world!`\n * and see it directly turning to a heading 1 (an `<h1>` HTML element).\n *\n * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>\n * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.\n *\n * @exampleComponent limel-example-text-editor-basic\n * @beta\n * @private\n */\n@Component({\n tag: 'limel-text-editor',\n shadow: true,\n styleUrl: 'text-editor.scss',\n})\nexport class TextEditor {\n @Element()\n private host: HTMLLimelTextEditorElement;\n\n @State()\n private view: EditorView;\n\n /**\n * Dispatched when a change is made to the editor\n */\n @Event()\n private change: EventEmitter<{ html: string }>;\n\n public componentWillLoad() {}\n\n public render() {\n return <div id=\"editor\" />;\n }\n\n public componentDidLoad() {\n const mySchema = new Schema({\n nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'),\n marks: schema.spec.marks,\n });\n\n const menu: MenuElement[][] = buildDefaultMenu(mySchema);\n\n this.view = new EditorView(\n this.host.shadowRoot.querySelector('#editor'),\n {\n state: EditorState.create({\n doc: DOMParser.fromSchema(mySchema).parse(\n this.host.shadowRoot.querySelector('#editor'),\n ),\n plugins: exampleSetup({\n schema: mySchema,\n menuContent: menu as MenuItem[][],\n }),\n }),\n dispatchTransaction: (transaction) => {\n const newState = this.view.state.apply(transaction);\n this.view.updateState(newState);\n\n this.change.emit({ html: this.view.dom.innerHTML });\n },\n },\n );\n }\n}\n"]}
|
|
@@ -15905,6 +15905,39 @@ function exampleSetup(options) {
|
|
|
15905
15905
|
}));
|
|
15906
15906
|
}
|
|
15907
15907
|
|
|
15908
|
+
/**
|
|
15909
|
+
* Creates the default menu for the text editor
|
|
15910
|
+
* based on the default menu already in prosemirror-example-setup
|
|
15911
|
+
* @param schema - the schema to use for the menu
|
|
15912
|
+
*
|
|
15913
|
+
* @returns the default menu for the text editor
|
|
15914
|
+
*/
|
|
15915
|
+
const buildDefaultMenu = (schema) => {
|
|
15916
|
+
const menuItems = buildMenuItems(schema);
|
|
15917
|
+
const { inlineMenu, insertHorizontalRule } = menuItems;
|
|
15918
|
+
const typeMenu = getNewMenu(menuItems.typeMenu);
|
|
15919
|
+
const newHorizontalRule = new MenuItem(Object.assign(Object.assign({}, insertHorizontalRule.spec), { label: 'hr' }));
|
|
15920
|
+
const historyButtons = menuItems.fullMenu[2];
|
|
15921
|
+
const blockMenu = getBlockMenu(menuItems.blockMenu);
|
|
15922
|
+
return [
|
|
15923
|
+
inlineMenu[0],
|
|
15924
|
+
[newHorizontalRule],
|
|
15925
|
+
...typeMenu,
|
|
15926
|
+
historyButtons,
|
|
15927
|
+
blockMenu,
|
|
15928
|
+
];
|
|
15929
|
+
};
|
|
15930
|
+
const getNewMenu = (typeMenu) => {
|
|
15931
|
+
const headingDropdown = new Dropdown(typeMenu.content[2].content, {
|
|
15932
|
+
label: 'H',
|
|
15933
|
+
});
|
|
15934
|
+
return [[typeMenu.content[0], typeMenu.content[1]], [headingDropdown]];
|
|
15935
|
+
};
|
|
15936
|
+
const getBlockMenu = (blockMenu) => {
|
|
15937
|
+
// eslint-disable-next-line no-magic-numbers
|
|
15938
|
+
return [...blockMenu[0].slice(0, 5)];
|
|
15939
|
+
};
|
|
15940
|
+
|
|
15908
15941
|
const textEditorCss = "@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-text-editor){isolation:isolate;display:block}*{box-sizing:border-box}.ProseMirror-menubar-wrapper{transition:border 0.2s ease;display:grid;grid-template-rows:auto 1fr;border-radius:0.25rem;border:1px solid;border-color:rgba(var(--contrast-700), 0.65)}.ProseMirror-menubar-wrapper:hover{border-color:rgba(var(--contrast-700), 1)}.ProseMirror-menubar-wrapper:focus-within{border-color:var(--mdc-theme-primary)}.ProseMirror-textblock-dropdown{min-width:3em}.ProseMirror-tooltip .ProseMirror-menu{width:-webkit-fit-content;width:fit-content;white-space:pre}.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;border-bottom-left-radius:0.5rem;border-bottom-right-radius:0.5rem;padding:0.5rem 1rem;background-color:rgb(var(--contrast-100))}.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}div#editor .ProseMirror-menubar{position:sticky !important;z-index:1;top:0}div#editor .ProseMirror-menubar[style*=\"position: fixed\"]{box-shadow:0 0.25rem 0.5rem -0.5rem rgb(var(--color-black), 0.8)}.ProseMirror-menubar{position:relative;z-index:1;display:flex;flex-wrap:wrap;gap:0.25rem;align-items:center;padding:0.125rem;background-color:rgb(var(--contrast-100));border-top-left-radius:0.5rem;border-top-right-radius:0.5rem}.ProseMirror-menuitem{position:relative;flex-shrink:0;display:flex;align-items:center;justify-content:center;white-space:nowrap;line-height:1;height:1.5rem;min-width:1.5rem;border-radius:0.25rem;color:rgb(var(--contrast-1100));font-size:0.8125rem}.ProseMirror-menuitem:not(:has(.ProseMirror-menu-disabled)){transition:color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;cursor:pointer;color:var(--mdc-theme-on-surface);background-color:transparent}.ProseMirror-menuitem:not(:has(.ProseMirror-menu-disabled)):hover{color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}.ProseMirror-menuitem:not(:has(.ProseMirror-menu-disabled)):active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}.ProseMirror-menuitem:has(.ProseMirror-menu-active){box-shadow:var(--button-shadow-inset);color:var(--mdc-theme-primary)}.ProseMirror-menuitem:has(.ProseMirror-menu-active) svg{color:var(--mdc-theme-primary)}.ProseMirror-menuitem:has(.ProseMirror-menu-dropdown-menu){box-shadow:var(--button-shadow-inset)}.ProseMirror-menuitem svg{fill:currentColor;height:1rem;color:rgb(var(--contrast-1100))}.ProseMirror-menuseparator{border-radius:1rem;background-color:rgb(var(--contrast-600));width:0.125rem;height:1rem}.ProseMirror-menu-dropdown{position:relative;display:flex;align-items:center;gap:0.5rem;padding:0 0.5rem}.ProseMirror-menu-dropdown:after{content:\"\";border-left:0.25rem solid transparent;border-right:0.25rem solid transparent;border-top:0.25rem solid currentColor}.ProseMirror-menu-dropdown-menu,.ProseMirror-menu-submenu{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12)}.ProseMirror-menu-dropdown-menu{position:absolute;top:100%;background:rgb(var(--contrast-100));border-radius:0.25rem;padding:0.125rem}.ProseMirror-menu-submenu{position:absolute;background:rgb(var(--contrast-100));border-radius:0.25rem;padding:0.125rem;display:none;min-width:4em;left:100%;top:-0.75rem}.ProseMirror-menu-dropdown-item{transition:background-color 0.2s ease;cursor:pointer;border-radius:0.375rem;min-height:2.5rem;display:flex;align-items:center;width:100%}.ProseMirror-menu-dropdown-item>div{padding:0 1rem;width:100%}.ProseMirror-menu-dropdown-item:not(:has(.ProseMirror-menu-disabled)):hover{background-color:rgb(var(--contrast-300))}.ProseMirror-menu-submenu-wrap{position:relative;margin-right:-0.25rem}.ProseMirror-menu-submenu-wrap:hover .ProseMirror-menu-submenu{display:block}.ProseMirror-menu-submenu-label{position:relative;display:flex;align-items:center;justify-content:space-between;gap:0.5rem}.ProseMirror-menu-submenu-label:after{content:\"\";border-top:0.25rem solid transparent;border-bottom:0.25rem solid transparent;border-left:0.25rem solid currentColor}.ProseMirror-menu-disabled{opacity:0.3;cursor:default}.ProseMirror-menu-submenu-wrap-active .ProseMirror-menu-submenu{display:block}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))}";
|
|
15909
15942
|
|
|
15910
15943
|
const TextEditor = class {
|
|
@@ -15922,10 +15955,14 @@ const TextEditor = class {
|
|
|
15922
15955
|
nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'),
|
|
15923
15956
|
marks: schema.spec.marks,
|
|
15924
15957
|
});
|
|
15958
|
+
const menu = buildDefaultMenu(mySchema);
|
|
15925
15959
|
this.view = new EditorView(this.host.shadowRoot.querySelector('#editor'), {
|
|
15926
15960
|
state: EditorState.create({
|
|
15927
15961
|
doc: DOMParser.fromSchema(mySchema).parse(this.host.shadowRoot.querySelector('#editor')),
|
|
15928
|
-
plugins: exampleSetup({
|
|
15962
|
+
plugins: exampleSetup({
|
|
15963
|
+
schema: mySchema,
|
|
15964
|
+
menuContent: menu,
|
|
15965
|
+
}),
|
|
15929
15966
|
}),
|
|
15930
15967
|
dispatchTransaction: (transaction) => {
|
|
15931
15968
|
const newState = this.view.state.apply(transaction);
|