@limetech/lime-elements 37.21.0 → 37.23.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/lime-elements.cjs.js +1 -1
  3. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +3 -3
  4. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
  5. package/dist/cjs/limel-text-editor.cjs.entry.js +7 -1
  6. package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/collection-manifest.json +1 -1
  9. package/dist/collection/components/text-editor/prosemirror-adapter/menu/full-menu.js.map +1 -0
  10. package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-filter.js.map +1 -0
  11. package/dist/collection/components/text-editor/prosemirror-adapter/menu/types.js.map +1 -0
  12. package/dist/collection/components/text-editor/{prosemirror-adapter.css → prosemirror-adapter/prosemirror-adapter.css} +4 -1
  13. package/dist/collection/components/text-editor/{prosemirror-adapter.js → prosemirror-adapter/prosemirror-adapter.js} +14 -16
  14. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -0
  15. package/dist/collection/components/text-editor/text-editor.css +8 -0
  16. package/dist/collection/components/text-editor/text-editor.js +24 -9
  17. package/dist/collection/components/text-editor/text-editor.js.map +1 -1
  18. package/dist/esm/lime-elements.js +1 -1
  19. package/dist/esm/limel-prosemirror-adapter.entry.js +3 -3
  20. package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
  21. package/dist/esm/limel-text-editor.entry.js +7 -1
  22. package/dist/esm/limel-text-editor.entry.js.map +1 -1
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/lime-elements/lime-elements.esm.js +1 -1
  25. package/dist/lime-elements/{p-0f45a6cc.entry.js → p-5b2e8739.entry.js} +2 -2
  26. package/dist/lime-elements/p-5b2e8739.entry.js.map +1 -0
  27. package/dist/lime-elements/p-caf959fe.entry.js +2 -0
  28. package/dist/lime-elements/p-caf959fe.entry.js.map +1 -0
  29. package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +26 -0
  30. package/dist/types/components/text-editor/text-editor.d.ts +14 -12
  31. package/dist/types/components.d.ts +54 -42
  32. package/package.json +1 -1
  33. package/dist/collection/components/text-editor/menu/full-menu.js.map +0 -1
  34. package/dist/collection/components/text-editor/menu/menu-filter.js.map +0 -1
  35. package/dist/collection/components/text-editor/menu/types.js.map +0 -1
  36. package/dist/collection/components/text-editor/prosemirror-adapter.js.map +0 -1
  37. package/dist/lime-elements/p-0f45a6cc.entry.js.map +0 -1
  38. package/dist/lime-elements/p-210c09a6.entry.js +0 -2
  39. package/dist/lime-elements/p-210c09a6.entry.js.map +0 -1
  40. package/dist/types/components/text-editor/prosemirror-adapter.d.ts +0 -32
  41. /package/dist/collection/components/text-editor/{menu → prosemirror-adapter/menu}/full-menu.js +0 -0
  42. /package/dist/collection/components/text-editor/{menu → prosemirror-adapter/menu}/menu-filter.js +0 -0
  43. /package/dist/collection/components/text-editor/{menu → prosemirror-adapter/menu}/types.js +0 -0
  44. /package/dist/types/components/text-editor/{menu → prosemirror-adapter/menu}/full-menu.d.ts +0 -0
  45. /package/dist/types/components/text-editor/{menu → prosemirror-adapter/menu}/menu-filter.d.ts +0 -0
  46. /package/dist/types/components/text-editor/{menu → prosemirror-adapter/menu}/types.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ import{r as e,c as i,h as t}from"./p-443111b3.js";const d=":host(limel-text-editor){--limel-text-editor-padding:0.5rem 1rem}limel-markdown{display:block;padding:var(--limel-text-editor-padding)}";const r=class{constructor(t){e(this,t);this.change=i(this,"change",7);this.handleChange=()=>e=>{e.stopPropagation();this.change.emit(e.detail)};this.disabled=undefined;this.readonly=undefined;this.helperText=undefined;this.placeholder=undefined;this.label=undefined;this.invalid=undefined;this.value=undefined}render(){return this.renderEditor()}renderEditor(){if(this.readonly){return t("limel-markdown",{value:this.value})}return t("limel-prosemirror-adapter",{onChange:this.handleChange,value:this.value})}};r.style=d;export{r as limel_text_editor};
2
+ //# sourceMappingURL=p-caf959fe.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["textEditorCss","TextEditor","this","handleChange","event","stopPropagation","change","emit","detail","render","renderEditor","readonly","h","value","onChange"],"sources":["./src/components/text-editor/text-editor.scss?tag=limel-text-editor&encapsulation=shadow","./src/components/text-editor/text-editor.tsx"],"sourcesContent":[":host(limel-text-editor) {\n --limel-text-editor-padding: 0.5rem 1rem;\n}\n\nlimel-markdown {\n display: block;\n padding: var(--limel-text-editor-padding);\n}\n","import { Component, Event, EventEmitter, Prop, h } from '@stencil/core';\nimport { FormComponent } from '../form/form.types';\n/**\n * A rich text editor that 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 * @exampleComponent limel-example-text-editor-as-form-component\n * @exampleComponent limel-example-text-editor-composite\n * @beta\n * @private\n */\n@Component({\n tag: 'limel-text-editor',\n shadow: true,\n styleUrl: 'text-editor.scss',\n})\nexport class TextEditor implements FormComponent<string> {\n /**\n * Set to `true` to disable the field.\n * Use `disabled` to indicate that the field can normally be interacted\n * with, but is currently disabled. This tells the user that if certain\n * requirements are met, the field may become enabled again.\n */\n @Prop({ reflect: true })\n public disabled?: boolean;\n\n /**\n * Set to `true` to make the component read-only.\n * Use `readonly` when the field is only there to present the data it holds,\n * and will not become possible for the current user to edit.\n * :::note\n * Consider that it might be better to use `limel-markdown`\n * instead of `limel-text-editor` when the goal is visualizing data.\n * :::\n */\n @Prop({ reflect: true })\n public readonly?: boolean;\n\n /**\n * Optional helper text to display below the input field when it has focus\n */\n @Prop({ reflect: true })\n public helperText?: string;\n\n /**\n * The placeholder text shown inside the input field,\n * when the field is empty.\n */\n @Prop({ reflect: true })\n public placeholder?: string;\n\n /**\n * The label of the editor\n */\n @Prop({ reflect: true })\n public label?: string;\n\n /**\n * Set to `true` to indicate that the current value of the editor is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid?: boolean;\n\n /**\n * Description of the text inside the editor as serialised HTML\n */\n @Prop({ reflect: true })\n public value: string;\n\n /**\n * Dispatched when a change is made to the editor\n */\n @Event()\n public change: EventEmitter<string>;\n\n public render() {\n return this.renderEditor();\n }\n\n private renderEditor() {\n if (this.readonly) {\n return <limel-markdown value={this.value} />;\n }\n\n return (\n <limel-prosemirror-adapter\n onChange={this.handleChange}\n value={this.value}\n />\n );\n }\n\n private handleChange = () => (event: CustomEvent<string>) => {\n event.stopPropagation();\n this.change.emit(event.detail);\n };\n}\n"],"mappings":"kDAAA,MAAMA,EAAgB,0I,MCsBTC,EAAU,M,wDA6EXC,KAAAC,aAAe,IAAOC,IAC1BA,EAAMC,kBACNH,KAAKI,OAAOC,KAAKH,EAAMI,OAAO,E,sKAnB3BC,SACH,OAAOP,KAAKQ,c,CAGRA,eACJ,GAAIR,KAAKS,SAAU,CACf,OAAOC,EAAA,kBAAgBC,MAAOX,KAAKW,O,CAGvC,OACID,EAAA,6BACIE,SAAUZ,KAAKC,aACfU,MAAOX,KAAKW,O"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The ProseMirror adapter offers a rich text editing experience with markdown support.
3
+ * [Read more...](https://prosemirror.net/)
4
+ *
5
+ * @exampleComponent limel-example-prosemirror-adapter-basic
6
+ * @exampleComponent limel-example-prosemirror-adapter-with-custom-menu
7
+ * @beta
8
+ * @private
9
+ */
10
+ export declare class ProsemirrorAdapter {
11
+ /**
12
+ * The value of the editor, expected to be serialised HTML
13
+ */
14
+ value: string;
15
+ private host;
16
+ private view;
17
+ /**
18
+ * Dispatched when a change is made to the editor
19
+ */
20
+ private change;
21
+ componentWillLoad(): void;
22
+ render(): any;
23
+ componentDidLoad(): void;
24
+ private getHTML;
25
+ }
26
+ //# sourceMappingURL=prosemirror-adapter.d.ts.map
@@ -1,16 +1,21 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
2
  import { FormComponent } from '../form/form.types';
3
3
  /**
4
- * A rich text editor that allows the user to input and format text
5
- * The `limel-text-editor` can be used as a form field
4
+ * A rich text editor that offers a rich text editing experience with markdown support,
5
+ * in the sense that you can easily type markdown syntax and see the rendered
6
+ * result as rich text in real-time. For instance, you can type `# Hello, world!`
7
+ * and see it directly turning to a heading 1 (an `<h1>` HTML element).
8
+ *
9
+ * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>
10
+ * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.
6
11
  *
7
12
  * @exampleComponent limel-example-text-editor-basic
13
+ * @exampleComponent limel-example-text-editor-as-form-component
14
+ * @exampleComponent limel-example-text-editor-composite
8
15
  * @beta
9
16
  * @private
10
17
  */
11
- export declare class TextEditor implements FormComponent<{
12
- html: string;
13
- }> {
18
+ export declare class TextEditor implements FormComponent<string> {
14
19
  /**
15
20
  * Set to `true` to disable the field.
16
21
  * Use `disabled` to indicate that the field can normally be interacted
@@ -47,18 +52,15 @@ export declare class TextEditor implements FormComponent<{
47
52
  */
48
53
  invalid?: boolean;
49
54
  /**
50
- * Description of the text inside the editor
55
+ * Description of the text inside the editor as serialised HTML
51
56
  */
52
- value: {
53
- html: string;
54
- };
57
+ value: string;
55
58
  /**
56
59
  * Dispatched when a change is made to the editor
57
60
  */
58
- change: EventEmitter<{
59
- html: string;
60
- }>;
61
+ change: EventEmitter<string>;
61
62
  render(): any;
63
+ private renderEditor;
62
64
  private handleChange;
63
65
  }
64
66
  //# sourceMappingURL=text-editor.d.ts.map
@@ -2054,21 +2054,18 @@ export namespace Components {
2054
2054
  "readonly": boolean;
2055
2055
  }
2056
2056
  /**
2057
- * The ProseMirror adapter offers a rich text editing experience with markdown support,
2058
- * in the sense that you can easily type markdown syntax and see the rendered
2059
- * result as rich text in real-time. For instance, you can type `# Hello, world!`
2060
- * and see it directly turning to a heading 1 (an `<h1>` HTML element).
2061
- * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>
2062
- * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.
2057
+ * The ProseMirror adapter offers a rich text editing experience with markdown support.
2058
+ * [Read more...](https://prosemirror.net/)
2063
2059
  * @exampleComponent limel-example-prosemirror-adapter-basic
2060
+ * @exampleComponent limel-example-prosemirror-adapter-with-custom-menu
2064
2061
  * @beta
2065
2062
  * @private
2066
2063
  */
2067
2064
  interface LimelProsemirrorAdapter {
2068
2065
  /**
2069
- * The value of the editor
2066
+ * The value of the editor, expected to be serialised HTML
2070
2067
  */
2071
- "value": { html: string };
2068
+ "value": string;
2072
2069
  }
2073
2070
  /**
2074
2071
  * @exampleComponent limel-example-select
@@ -2475,9 +2472,15 @@ export namespace Components {
2475
2472
  "totalRows": number;
2476
2473
  }
2477
2474
  /**
2478
- * A rich text editor that allows the user to input and format text
2479
- * The `limel-text-editor` can be used as a form field
2475
+ * A rich text editor that offers a rich text editing experience with markdown support,
2476
+ * in the sense that you can easily type markdown syntax and see the rendered
2477
+ * result as rich text in real-time. For instance, you can type `# Hello, world!`
2478
+ * and see it directly turning to a heading 1 (an `<h1>` HTML element).
2479
+ * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>
2480
+ * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.
2480
2481
  * @exampleComponent limel-example-text-editor-basic
2482
+ * @exampleComponent limel-example-text-editor-as-form-component
2483
+ * @exampleComponent limel-example-text-editor-composite
2481
2484
  * @beta
2482
2485
  * @private
2483
2486
  */
@@ -2507,9 +2510,9 @@ export namespace Components {
2507
2510
  */
2508
2511
  "readonly"?: boolean;
2509
2512
  /**
2510
- * Description of the text inside the editor
2513
+ * Description of the text inside the editor as serialised HTML
2511
2514
  */
2512
- "value": { html: string };
2515
+ "value": string;
2513
2516
  }
2514
2517
  /**
2515
2518
  * A tooltip can be used to display a descriptive text for any element.
@@ -3803,13 +3806,10 @@ declare global {
3803
3806
  new (): HTMLLimelProgressFlowItemElement;
3804
3807
  };
3805
3808
  /**
3806
- * The ProseMirror adapter offers a rich text editing experience with markdown support,
3807
- * in the sense that you can easily type markdown syntax and see the rendered
3808
- * result as rich text in real-time. For instance, you can type `# Hello, world!`
3809
- * and see it directly turning to a heading 1 (an `<h1>` HTML element).
3810
- * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>
3811
- * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.
3809
+ * The ProseMirror adapter offers a rich text editing experience with markdown support.
3810
+ * [Read more...](https://prosemirror.net/)
3812
3811
  * @exampleComponent limel-example-prosemirror-adapter-basic
3812
+ * @exampleComponent limel-example-prosemirror-adapter-with-custom-menu
3813
3813
  * @beta
3814
3814
  * @private
3815
3815
  */
@@ -4015,9 +4015,15 @@ declare global {
4015
4015
  new (): HTMLLimelTableElement;
4016
4016
  };
4017
4017
  /**
4018
- * A rich text editor that allows the user to input and format text
4019
- * The `limel-text-editor` can be used as a form field
4018
+ * A rich text editor that offers a rich text editing experience with markdown support,
4019
+ * in the sense that you can easily type markdown syntax and see the rendered
4020
+ * result as rich text in real-time. For instance, you can type `# Hello, world!`
4021
+ * and see it directly turning to a heading 1 (an `<h1>` HTML element).
4022
+ * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>
4023
+ * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.
4020
4024
  * @exampleComponent limel-example-text-editor-basic
4025
+ * @exampleComponent limel-example-text-editor-as-form-component
4026
+ * @exampleComponent limel-example-text-editor-composite
4021
4027
  * @beta
4022
4028
  * @private
4023
4029
  */
@@ -6309,13 +6315,10 @@ declare namespace LocalJSX {
6309
6315
  "readonly"?: boolean;
6310
6316
  }
6311
6317
  /**
6312
- * The ProseMirror adapter offers a rich text editing experience with markdown support,
6313
- * in the sense that you can easily type markdown syntax and see the rendered
6314
- * result as rich text in real-time. For instance, you can type `# Hello, world!`
6315
- * and see it directly turning to a heading 1 (an `<h1>` HTML element).
6316
- * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>
6317
- * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.
6318
+ * The ProseMirror adapter offers a rich text editing experience with markdown support.
6319
+ * [Read more...](https://prosemirror.net/)
6318
6320
  * @exampleComponent limel-example-prosemirror-adapter-basic
6321
+ * @exampleComponent limel-example-prosemirror-adapter-with-custom-menu
6319
6322
  * @beta
6320
6323
  * @private
6321
6324
  */
@@ -6323,11 +6326,11 @@ declare namespace LocalJSX {
6323
6326
  /**
6324
6327
  * Dispatched when a change is made to the editor
6325
6328
  */
6326
- "onChange"?: (event: LimelProsemirrorAdapterCustomEvent<{ html: string }>) => void;
6329
+ "onChange"?: (event: LimelProsemirrorAdapterCustomEvent<string>) => void;
6327
6330
  /**
6328
- * The value of the editor
6331
+ * The value of the editor, expected to be serialised HTML
6329
6332
  */
6330
- "value"?: { html: string };
6333
+ "value"?: string;
6331
6334
  }
6332
6335
  /**
6333
6336
  * @exampleComponent limel-example-select
@@ -6790,9 +6793,15 @@ declare namespace LocalJSX {
6790
6793
  "totalRows"?: number;
6791
6794
  }
6792
6795
  /**
6793
- * A rich text editor that allows the user to input and format text
6794
- * The `limel-text-editor` can be used as a form field
6796
+ * A rich text editor that offers a rich text editing experience with markdown support,
6797
+ * in the sense that you can easily type markdown syntax and see the rendered
6798
+ * result as rich text in real-time. For instance, you can type `# Hello, world!`
6799
+ * and see it directly turning to a heading 1 (an `<h1>` HTML element).
6800
+ * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>
6801
+ * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.
6795
6802
  * @exampleComponent limel-example-text-editor-basic
6803
+ * @exampleComponent limel-example-text-editor-as-form-component
6804
+ * @exampleComponent limel-example-text-editor-composite
6796
6805
  * @beta
6797
6806
  * @private
6798
6807
  */
@@ -6816,7 +6825,7 @@ declare namespace LocalJSX {
6816
6825
  /**
6817
6826
  * Dispatched when a change is made to the editor
6818
6827
  */
6819
- "onChange"?: (event: LimelTextEditorCustomEvent<{ html: string }>) => void;
6828
+ "onChange"?: (event: LimelTextEditorCustomEvent<string>) => void;
6820
6829
  /**
6821
6830
  * The placeholder text shown inside the input field, when the field is empty.
6822
6831
  */
@@ -6826,9 +6835,9 @@ declare namespace LocalJSX {
6826
6835
  */
6827
6836
  "readonly"?: boolean;
6828
6837
  /**
6829
- * Description of the text inside the editor
6838
+ * Description of the text inside the editor as serialised HTML
6830
6839
  */
6831
- "value"?: { html: string };
6840
+ "value"?: string;
6832
6841
  }
6833
6842
  /**
6834
6843
  * A tooltip can be used to display a descriptive text for any element.
@@ -7773,13 +7782,10 @@ declare module "@stencil/core" {
7773
7782
  */
7774
7783
  "limel-progress-flow-item": LocalJSX.LimelProgressFlowItem & JSXBase.HTMLAttributes<HTMLLimelProgressFlowItemElement>;
7775
7784
  /**
7776
- * The ProseMirror adapter offers a rich text editing experience with markdown support,
7777
- * in the sense that you can easily type markdown syntax and see the rendered
7778
- * result as rich text in real-time. For instance, you can type `# Hello, world!`
7779
- * and see it directly turning to a heading 1 (an `<h1>` HTML element).
7780
- * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>
7781
- * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.
7785
+ * The ProseMirror adapter offers a rich text editing experience with markdown support.
7786
+ * [Read more...](https://prosemirror.net/)
7782
7787
  * @exampleComponent limel-example-prosemirror-adapter-basic
7788
+ * @exampleComponent limel-example-prosemirror-adapter-with-custom-menu
7783
7789
  * @beta
7784
7790
  * @private
7785
7791
  */
@@ -7930,9 +7936,15 @@ declare module "@stencil/core" {
7930
7936
  */
7931
7937
  "limel-table": LocalJSX.LimelTable & JSXBase.HTMLAttributes<HTMLLimelTableElement>;
7932
7938
  /**
7933
- * A rich text editor that allows the user to input and format text
7934
- * The `limel-text-editor` can be used as a form field
7939
+ * A rich text editor that offers a rich text editing experience with markdown support,
7940
+ * in the sense that you can easily type markdown syntax and see the rendered
7941
+ * result as rich text in real-time. For instance, you can type `# Hello, world!`
7942
+ * and see it directly turning to a heading 1 (an `<h1>` HTML element).
7943
+ * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>
7944
+ * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.
7935
7945
  * @exampleComponent limel-example-text-editor-basic
7946
+ * @exampleComponent limel-example-text-editor-as-form-component
7947
+ * @exampleComponent limel-example-text-editor-composite
7936
7948
  * @beta
7937
7949
  * @private
7938
7950
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "37.21.0",
3
+ "version": "37.23.0",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"full-menu.js","sourceRoot":"","sources":["../../../../src/components/text-editor/menu/full-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,aAA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\nimport { buildMenuItems } from 'prosemirror-example-setup';\n\n/**\n * Creates the full 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 buildFullMenu = (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 title: 'hr',\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"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu-filter.js","sourceRoot":"","sources":["../../../../src/components/text-editor/menu/menu-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyB,MAAM,kBAAkB,CAAC;AAGnE;;;;;GAKG;AACH,MAAM,QAAQ,GAAiC;EAC3C,MAAM,EAAE,qBAAqB;EAC7B,QAAQ,EAAE,iBAAiB;EAC3B,IAAI,EAAE,kBAAkB;EACxB,IAAI,EAAE,oBAAoB;EAC1B,iBAAiB,EAAE,IAAI;EAC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zB,OAAO,IAAI,CAAC;KACf;IAED,OAAO,KAAK,CAAC;EACjB,CAAC,CAAC;KACD,MAAM,CAAC,OAAO,CAAC;KACf,GAAG,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,sBAAsB,GACxB,CAAC,KAA2B,EAAE,EAAE,CAAC,CAAC,IAAiB,EAAE,EAAE;EACnD,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;IAClB,OAAO,IAAI,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;MACtD,KAAK,EAAE,IAAI,CAAC,KAAK;KACpB,CAAC,CAAC;GACN;EAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEN,MAAM,UAAU,GAAG,CAAC,IAAS,EAAoB,EAAE;EAC/C,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CACf,IAAS,EACgD,EAAE;EAC3D,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC;AACtC,CAAC,CAAC","sourcesContent":["import { Dropdown, MenuElement, MenuItem } from 'prosemirror-menu';\nimport { EditorButton, EditorPluginButton } from './types';\n\n/**\n * The available items for the editor toolbar\n * The values must match the titles of the menuItem\n *\n * {@link MenuItem.spec}\n */\nconst allItems: Record<EditorButton, string> = {\n strong: 'Toggle strong style',\n emphasis: 'Toggle emphasis',\n code: 'Toggle code font',\n link: 'Add or remove link',\n 'horizontal rule': 'hr',\n paragraph: 'Change to paragraph',\n 'code block': 'Change to code block',\n 'heading 1': 'Change to heading 1',\n 'heading 2': 'Change to heading 2',\n 'heading 3': 'Change to heading 3',\n 'heading 4': 'Change to heading 4',\n 'heading 5': 'Change to heading 5',\n 'heading 6': 'Change to heading 6',\n undo: 'Undo last change',\n redo: 'Redo last undone change',\n 'bullet list': 'Wrap in bullet list',\n 'ordered list': 'Wrap in ordered list',\n 'block quote': 'Wrap in block quote',\n 'join above': 'Join with above block',\n 'lift out': 'Lift out of enclosing block',\n};\n\nconst defaultItems: EditorButton[] = [\n 'strong',\n 'emphasis',\n 'link',\n 'heading 1',\n 'heading 2',\n 'heading 3',\n 'heading 4',\n 'heading 5',\n 'heading 6',\n 'block quote',\n 'bullet list',\n 'ordered list',\n];\n\n/**\n * Filters the full menu recursively based on the items provided\n *\n * @param menu - The menu to filter\n * @param items - The menu items to display. If undefined, all items will be displayed\n * @returns The filtered menu\n */\nexport const getFilteredMenu = (\n menu: MenuElement[],\n items: EditorPluginButton[] | undefined,\n): MenuElement[] => {\n let menuItems: string[] = defaultItems.map(\n (item: EditorButton) => allItems[item],\n );\n\n if (items !== undefined) {\n menuItems = menuItems.concat(\n items.map((item: EditorButton) => allItems[item]),\n );\n }\n\n return menu\n .filter((item: MenuElement) => {\n if (isMenuItem(item)) {\n return Object.values(menuItems).includes(\n item.spec.title as string,\n );\n } else if (isDropdown(item)) {\n return true;\n }\n\n return false;\n })\n .filter(Boolean)\n .map(createFilteredDropdown(items));\n};\n\nconst createFilteredDropdown =\n (items: EditorPluginButton[]) => (item: MenuElement) => {\n if (isDropdown(item)) {\n return new Dropdown(getFilteredMenu(item.content, items), {\n label: item.label,\n });\n }\n\n return item;\n };\n\nconst isMenuItem = (item: any): item is MenuItem => {\n return item.spec !== undefined;\n};\n\nconst isDropdown = (\n item: any,\n): item is Dropdown & { content: MenuItem[]; label: string } => {\n return item.content !== undefined;\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/text-editor/menu/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The `EditorButton` type is used to specify the type of buttons that can be used in the editor toolbar.\n * Each string represents a different button that can be added to the toolbar.\n *\n * The following buttons are available:\n * 'strong' - Button for making text bold.\n * 'emphasis' - Button for italicizing text.\n * 'link' - Button for adding a hyperlink.\n * 'heading 1 - Button for creating a level 1 heading.\n * 'heading 2 - Button for creating a level 2 heading.\n * 'heading 3 - Button for creating a level 3 heading.\n * 'heading 4 - Button for creating a level 4 heading.\n * 'heading 5 - Button for creating a level 5 heading.\n * 'heading 6 - Button for creating a level 6 heading.\n * 'block quote' - Button for creating a block quote.\n *\n * @beta\n */\nexport type EditorButton =\n | 'strong'\n | 'emphasis'\n | 'link'\n | 'heading 1'\n | 'heading 2'\n | 'heading 3'\n | 'heading 4'\n | 'heading 5'\n | 'heading 6'\n | 'block quote'\n | 'bullet list'\n | 'ordered list'\n | EditorPluginButton;\n\n/**\n * The `EditorPluginButton` type is used to specify the type of buttons that can be added to the editor toolbar.\n *\n * 'code' - Button for marking inline code.\n * 'horizontal rule' - Button for inserting a horizontal rule.\n * 'code block' - Button for creating a block of code.\n * 'paragraph'- Button for creating a new paragraph.\n * 'join above' - Button for joining the current block with the one above it.\n * 'lift out' - Button for lifting the current block out of its parent block.\n * 'undo' - Button for undoing the last action.\n * 'redo' - Button for redoing the last undone action.\n *\n * @beta\n */\nexport type EditorPluginButton =\n | 'code'\n | 'horizontal rule'\n | 'code block'\n | 'paragraph'\n | 'join above'\n | 'lift out'\n | 'undo'\n | 'redo';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prosemirror-adapter.js","sourceRoot":"","sources":["../../../src/components/text-editor/prosemirror-adapter.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,IAAI,EACJ,KAAK,EACL,CAAC,GACJ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,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AAC,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,OAAO,EAAE,EAAE,CAAC,CAAC;MAC/C,CAAC;KACJ,CACJ,CAAC;IAEF,IAAI,IAAI,CAAC,KAAK,EAAE;MACZ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;KAC7C;EACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASJ","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Prop,\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 { buildFullMenu } from './menu/full-menu';\nimport { getFilteredMenu } from './menu/menu-filter';\n\n/**\n * The ProseMirror adapter 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-prosemirror-adapter-basic\n * @beta\n * @private\n */\n@Component({\n tag: 'limel-prosemirror-adapter',\n shadow: true,\n styleUrl: 'prosemirror-adapter.scss',\n})\nexport class ProsemirrorAdapter {\n /**\n * The value of the editor\n */\n @Prop()\n public value: { html: string };\n\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[][] = buildFullMenu(mySchema)\n .map((items) => getFilteredMenu(items, undefined))\n .filter((items) => items.length);\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.getHTML() });\n },\n },\n );\n\n if (this.value) {\n this.view.dom.innerHTML = this.value.html;\n }\n }\n\n private getHTML = (): string => {\n if (this.view.dom.textContent === '') {\n return '';\n } else {\n return this.view.dom.innerHTML;\n }\n };\n}\n"]}