@limetech/lime-elements 39.39.1 → 39.41.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 +14 -0
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-file.cjs.entry.js +15 -5
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +440 -212
- package/dist/cjs/limel-text-editor.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{types-Bu6wcdI0.js → types-C7gNcwzE.js} +12 -0
- package/dist/collection/components/file/file.js +16 -5
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/inserter.js +101 -30
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/node.js +160 -54
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/view.js +6 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +51 -5
- package/dist/collection/components/text-editor/text-editor.js +33 -3
- package/dist/collection/components/text-editor/text-editor.types.js +10 -1
- package/dist/collection/components/text-editor/utils/content-type-converter.js +30 -1
- package/dist/collection/components/text-editor/utils/html-converter.js +4 -2
- package/dist/collection/components/text-editor/utils/markdown-converter.js +9 -5
- package/dist/esm/index.js +1 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-file.entry.js +15 -5
- package/dist/esm/limel-prosemirror-adapter.entry.js +440 -212
- package/dist/esm/limel-text-editor.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{types-BWYo6dLf.js → types-C_Yu8dOg.js} +12 -1
- package/dist/lime-elements/index.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-1f35fc44.entry.js +1 -0
- package/dist/lime-elements/p-56781dc7.entry.js +1 -0
- package/dist/lime-elements/p-5cf7464f.entry.js +1 -0
- package/dist/lime-elements/p-C_Yu8dOg.js +1 -0
- package/dist/types/components/file/file.d.ts +3 -0
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/inserter.d.ts +2 -2
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/node.d.ts +41 -19
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +13 -1
- package/dist/types/components/text-editor/text-editor.d.ts +10 -2
- package/dist/types/components/text-editor/text-editor.types.d.ts +52 -0
- package/dist/types/components/text-editor/utils/content-type-converter.d.ts +12 -0
- package/dist/types/components/text-editor/utils/html-converter.d.ts +3 -1
- package/dist/types/components/text-editor/utils/markdown-converter.d.ts +3 -1
- package/dist/types/components.d.ts +34 -6
- package/dist/types/global/shared-types/file.types.d.ts +10 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-366419ee.entry.js +0 -1
- package/dist/lime-elements/p-BWYo6dLf.js +0 -1
- package/dist/lime-elements/p-b7d734d2.entry.js +0 -1
- package/dist/lime-elements/p-b97f2f56.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,c as t,h as e,H as s}from"./p-BGxJfR2f.js";import{t as r}from"./p-EPnIW0K5.js";import{g as n,a,b as o,c as h}from"./p-BCq5M9TE.js";import{f as l}from"./p-u_sd2HMb.js";import"./p-Bu_YRgCL.js";import"./p-CgNJbSP4.js";const d={id:null,text:null,removable:!0},p=class{constructor(e){i(this,e),this.change=t(this,"change"),this.interact=t(this,"interact"),this.required=!1,this.disabled=!1,this.readonly=!1,this.invalid=!1,this.loading=!1,this.accept="*",this.language="en",this.dropZoneTip=()=>this.getTranslation("file.drag-and-drop-tips"),this.handleNewFiles=i=>{this.preventAndStop(i),this.change.emit(i.detail[0])},this.handleChipSetChange=i=>{i.stopPropagation();const t=0===i.detail.length?i.detail[0]:null;t||this.change.emit(t)},this.handleChipInteract=i=>{this.preventAndStop(i),this.interact.emit(i.detail.id)}}render(){return e(s,{key:"efdeb4e071a7bf484780eb239a1117a0e0fd0472","aria-busy":this.isBusy?"true":"false"},e("limel-file-dropzone",{key:"88d3924f5db23d1f3b07321bc7dc35663feeac8f",disabled:this.disabled||this.readonly||!!this.value,accept:this.accept,onFilesSelected:this.handleNewFiles},this.renderChipset()),this.renderDragAndDropTip(),this.renderSpinner())}get statusText(){var i,t,e;return null!==(e=null===(t=null===(i=this.value)||void 0===i?void 0:i.statusText)||void 0===t?void 0:t.trim())&&void 0!==e?e:""}get isBusy(){var i,t;return this.loading||Boolean(null===(i=this.value)||void 0===i?void 0:i.loading)||void 0!==(null===(t=this.value)||void 0===t?void 0:t.progress)}renderSpinner(){if(this.isBusy)return e("limel-spinner",null)}renderDragAndDropTip(){if(!(this.value||this.disabled||this.readonly||this.isBusy))return e("div",{class:"drag-and-drop-tip"},e("span",{class:"invisible-label-mock",role:"presentation"},this.label),e("span",{class:"tip"},this.dropZoneTip()))}getChipArray(){return this.value?[Object.assign(Object.assign({},d),{text:this.value.filename,id:this.value.id,icon:{name:h(this.value),title:o(this.value),color:a(this.value),backgroundColor:n(this.value)},badge:this.getBadge(),href:this.value.href,menuItems:this.value.menuItems,loading:this.value.loading,progress:this.value.progress,invalid:this.value.invalid})]:[]}getBadge(){return this.statusText?this.statusText:"number"==typeof this.value.size?l(this.value.size):void 0}renderChipset(){const i=e("limel-chip-set",{disabled:this.disabled,readonly:this.readonly,invalid:this.invalid,label:this.label,helperText:this.helperText,leadingIcon:"upload_to_cloud",language:this.language,onChange:this.handleChipSetChange,onInteract:this.handleChipInteract,required:this.required,type:"input",value:this.getChipArray()});return this.value?i:e("limel-file-input",{accept:this.accept,disabled:this.disabled||this.readonly},i)}preventAndStop(i){i.stopPropagation(),i.preventDefault()}getTranslation(i){return r.get(i,this.language)}};p.style='@charset "UTF-8";:host(limel-file){--badge-max-width:auto;position:relative}.drag-and-drop-tip{pointer-events:none;position:absolute;box-sizing:border-box;margin:0.25rem;inset:0;display:flex;align-items:center;justify-content:flex-end;flex-wrap:nowrap;border-radius:0.25rem;border:1px dashed rgb(var(--contrast-700));padding:0 0.5rem}.drag-and-drop-tip .invisible-label-mock{flex-shrink:0;opacity:0;padding-right:1rem;padding-left:1.5rem}.drag-and-drop-tip .tip{font-size:smaller;color:var(--limel-theme-text-secondary-on-background-color);height:auto;max-height:3rem;line-height:1;display:-webkit-box;overflow:hidden;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2}limel-spinner{pointer-events:none;position:absolute;inset:0 0.375rem 0 auto;margin:auto}';export{p as limel_file}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return"tagName"in e}const t={Bold:"strong",Italic:"em",Blockquote:"blockquote",HeaderLevel1:"headerlevel1",HeaderLevel2:"headerlevel2",HeaderLevel3:"headerlevel3",Link:"link",OrderedList:"ordered_list",BulletList:"bullet_list",Strikethrough:"strikethrough",Code:"code",CodeBlock:"code_block"},l=Object.values(t),o={Heading:"heading",one:1,two:2,three:3},d={Left:0,Middle:1,Right:2};export{t as E,o as L,d as M,l as e,e as i}
|
|
@@ -36,6 +36,7 @@ import { FileInfo } from '../../global/shared-types/file.types';
|
|
|
36
36
|
* @exampleComponent limel-example-file-per-file-loading
|
|
37
37
|
* @exampleComponent limel-example-file-per-file-progress
|
|
38
38
|
* @exampleComponent limel-example-file-per-file-invalid
|
|
39
|
+
* @exampleComponent limel-example-file-per-file-status
|
|
39
40
|
* @exampleComponent limel-example-file-menu-items
|
|
40
41
|
* @exampleComponent limel-example-file-accepted-types
|
|
41
42
|
* @exampleComponent limel-example-file-composite
|
|
@@ -94,6 +95,7 @@ export declare class File {
|
|
|
94
95
|
*/
|
|
95
96
|
private interact;
|
|
96
97
|
render(): any;
|
|
98
|
+
private get statusText();
|
|
97
99
|
/**
|
|
98
100
|
* The component is busy for any reason: its own `loading`, or a file that
|
|
99
101
|
* is `loading` or has `progress` (including `0`). Completion is signalled
|
|
@@ -106,6 +108,7 @@ export declare class File {
|
|
|
106
108
|
private dropZoneTip;
|
|
107
109
|
private handleNewFiles;
|
|
108
110
|
private getChipArray;
|
|
111
|
+
private getBadge;
|
|
109
112
|
private renderChipset;
|
|
110
113
|
private handleChipSetChange;
|
|
111
114
|
private handleChipInteract;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
3
|
import { FileInfo } from '../../../../../global/shared-types/file.types';
|
|
4
|
-
import { ImageInserter } from '../../../text-editor.types';
|
|
4
|
+
import { ImageInserter, InlineImages } from '../../../text-editor.types';
|
|
5
5
|
export declare const pluginKey: PluginKey<any>;
|
|
6
6
|
type ImagePastedCallback = (data: ImageInserter) => CustomEvent<ImageInserter>;
|
|
7
|
-
export declare const createImageInserterPlugin: (imagePastedCallback: ImagePastedCallback) => Plugin<any>;
|
|
7
|
+
export declare const createImageInserterPlugin: (imagePastedCallback: ImagePastedCallback, inlineImages?: InlineImages) => Plugin<any>;
|
|
8
8
|
export declare const imageInserterFactory: (view: EditorView, base64Data: string, fileInfo: FileInfo) => ImageInserter;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=inserter.d.ts.map
|
|
@@ -1,41 +1,63 @@
|
|
|
1
1
|
import { NodeSpec, Node } from 'prosemirror-model';
|
|
2
|
-
import { EditorImageState } from '../../../text-editor.types';
|
|
2
|
+
import { EditorImageState, InlineImages } from '../../../text-editor.types';
|
|
3
3
|
import { MarkdownSerializerState } from 'prosemirror-markdown';
|
|
4
4
|
import { Languages } from '../../../../date-picker/date.types';
|
|
5
5
|
export declare const imageCache: Map<string, HTMLImageElement>;
|
|
6
6
|
type MarkdownSerializerFunction = (state: MarkdownSerializerState, node: Node) => void;
|
|
7
|
+
export declare const IMAGE_ID_ATTRIBUTE = "image-id";
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* The attribute names accepted for an inline-image tag. Backs the sanitizer
|
|
10
|
+
* whitelist built in `buildContentWhitelist`, so a stored tag keeps these
|
|
11
|
+
* attributes through parsing. The serializers here enumerate their own output
|
|
12
|
+
* attributes separately and are not driven by this list.
|
|
13
|
+
*/
|
|
14
|
+
export declare const INLINE_IMAGE_ATTRIBUTES: string[];
|
|
15
|
+
export interface ImageNodeAttrs {
|
|
16
|
+
src: string;
|
|
17
|
+
alt: string;
|
|
18
|
+
state: EditorImageState;
|
|
19
|
+
/**
|
|
20
|
+
* Transient, per-session key used to correlate an async upload with its
|
|
21
|
+
* thumbnail node and to key the image cache. Not persisted; regenerated
|
|
22
|
+
* when content is parsed.
|
|
23
|
+
*/
|
|
24
|
+
fileInfoId: string | number;
|
|
25
|
+
/**
|
|
26
|
+
* Opaque id of the stored image, set when inline images are configured and
|
|
27
|
+
* persisted on the tag.
|
|
28
|
+
*/
|
|
29
|
+
imageId?: string;
|
|
30
|
+
height?: string;
|
|
31
|
+
width?: string;
|
|
32
|
+
minHeight?: string;
|
|
33
|
+
minWidth?: string;
|
|
34
|
+
maxWidth?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Builds the `image` NodeSpec, wired for inline-image parsing/serialization
|
|
38
|
+
* when `inlineImages` is configured.
|
|
9
39
|
* @param language
|
|
40
|
+
* @param inlineImages
|
|
10
41
|
*/
|
|
11
|
-
export declare function getImageNode(language: Languages): Record<string, NodeSpec>;
|
|
42
|
+
export declare function getImageNode(language: Languages, inlineImages?: InlineImages): Record<string, NodeSpec>;
|
|
12
43
|
/**
|
|
13
|
-
*
|
|
44
|
+
* Builds the markdown serializer for the `image` node, emitting the inline-image
|
|
45
|
+
* tag when `inlineImages` is configured and a `<img>` otherwise.
|
|
14
46
|
* @param language
|
|
47
|
+
* @param inlineImages
|
|
15
48
|
*/
|
|
16
|
-
export declare function getImageNodeMarkdownSerializer(language: Languages): Record<string, MarkdownSerializerFunction>;
|
|
49
|
+
export declare function getImageNodeMarkdownSerializer(language: Languages, inlineImages?: InlineImages): Record<string, MarkdownSerializerFunction>;
|
|
17
50
|
/**
|
|
18
|
-
*
|
|
51
|
+
* Applies the node's stored dimensions to a rendered `<img>` element.
|
|
19
52
|
* @param img
|
|
20
53
|
* @param node
|
|
21
54
|
*/
|
|
22
55
|
export declare function applyImageStyles(img: HTMLImageElement, node: Node): void;
|
|
23
56
|
/**
|
|
24
|
-
* Recursively checks if a ProseMirror node or
|
|
25
|
-
*
|
|
57
|
+
* Recursively checks if a ProseMirror node or any of its descendants is an
|
|
58
|
+
* image node.
|
|
26
59
|
* @param node
|
|
27
60
|
*/
|
|
28
61
|
export declare function hasImageNode(node: Node): boolean;
|
|
29
|
-
export interface ImageNodeAttrs {
|
|
30
|
-
src: string;
|
|
31
|
-
alt: string;
|
|
32
|
-
state: EditorImageState;
|
|
33
|
-
fileInfoId: string | number;
|
|
34
|
-
height?: string;
|
|
35
|
-
width?: string;
|
|
36
|
-
minHeight?: string;
|
|
37
|
-
minWidth?: string;
|
|
38
|
-
maxWidth?: string;
|
|
39
|
-
}
|
|
40
62
|
export {};
|
|
41
63
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Languages } from '../../date-picker/date.types';
|
|
2
2
|
import { CustomElementDefinition } from '../../../global/shared-types/custom-element.types';
|
|
3
|
-
import { TriggerCharacter } from '../text-editor.types';
|
|
3
|
+
import { TriggerCharacter, InlineImages } from '../text-editor.types';
|
|
4
4
|
import { EditorUiType } from '../types';
|
|
5
5
|
/**
|
|
6
6
|
* The ProseMirror adapter offers a rich text editing experience with markdown support.
|
|
@@ -40,6 +40,16 @@ export declare class ProsemirrorAdapter {
|
|
|
40
40
|
* @alpha
|
|
41
41
|
*/
|
|
42
42
|
customElements: CustomElementDefinition[];
|
|
43
|
+
/**
|
|
44
|
+
* Configures inline image support. When set, the editor owns the paste +
|
|
45
|
+
* upload lifecycle and persists images either as the configured tag
|
|
46
|
+
* carrying only a file id (`InlineImageTag`), or as a plain `<img src>`
|
|
47
|
+
* (`InlineImageSrc`).
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
* @alpha
|
|
51
|
+
*/
|
|
52
|
+
inlineImages?: InlineImages;
|
|
43
53
|
/**
|
|
44
54
|
* set to private to avoid usage while under development
|
|
45
55
|
*
|
|
@@ -63,6 +73,7 @@ export declare class ProsemirrorAdapter {
|
|
|
63
73
|
private menuCommandFactory;
|
|
64
74
|
private schema;
|
|
65
75
|
private contentConverter;
|
|
76
|
+
private validatedInlineImages?;
|
|
66
77
|
private actionBarElement;
|
|
67
78
|
private lastEmittedValue;
|
|
68
79
|
/**
|
|
@@ -137,6 +148,7 @@ export declare class ProsemirrorAdapter {
|
|
|
137
148
|
render(): any;
|
|
138
149
|
renderToolbar(): any;
|
|
139
150
|
renderLinkMenu(): any;
|
|
151
|
+
private validateInlineImages;
|
|
140
152
|
private setupContentConverter;
|
|
141
153
|
private getActionBarItems;
|
|
142
154
|
private getTranslatedItem;
|
|
@@ -2,7 +2,7 @@ import { EventEmitter } from '../../stencil-public-runtime';
|
|
|
2
2
|
import { FormComponent } from '../form/form.types';
|
|
3
3
|
import { Languages } from '../date-picker/date.types';
|
|
4
4
|
import { CustomElementDefinition } from '../../global/shared-types/custom-element.types';
|
|
5
|
-
import { TriggerCharacter, TriggerEventDetail } from './text-editor.types';
|
|
5
|
+
import { TriggerCharacter, TriggerEventDetail, InlineImages } from './text-editor.types';
|
|
6
6
|
import { EditorUiType } from './types';
|
|
7
7
|
/**
|
|
8
8
|
* A rich text editor that offers a rich text editing experience with markdown support,
|
|
@@ -18,8 +18,8 @@ import { EditorUiType } from './types';
|
|
|
18
18
|
* @exampleComponent limel-example-text-editor-with-markdown
|
|
19
19
|
* @exampleComponent limel-example-text-editor-with-html
|
|
20
20
|
* @exampleComponent limel-example-text-editor-with-tables
|
|
21
|
-
* @exampleComponent limel-example-text-editor-with-inline-images-file-storage
|
|
22
21
|
* @exampleComponent limel-example-text-editor-with-inline-images-base64
|
|
22
|
+
* @exampleComponent limel-example-text-editor-with-inline-images-custom-tag
|
|
23
23
|
* @exampleComponent limel-example-text-editor-allow-resize
|
|
24
24
|
* @exampleComponent limel-example-text-editor-size
|
|
25
25
|
* @exampleComponent limel-example-text-editor-ui
|
|
@@ -88,6 +88,14 @@ export declare class TextEditor implements FormComponent<string> {
|
|
|
88
88
|
* @alpha
|
|
89
89
|
*/
|
|
90
90
|
customElements: CustomElementDefinition[];
|
|
91
|
+
/**
|
|
92
|
+
* Configures inline image support: the editor owns the paste lifecycle and
|
|
93
|
+
* resize, the consumer owns upload, storage format, and URL resolution.
|
|
94
|
+
*
|
|
95
|
+
* @private
|
|
96
|
+
* @alpha
|
|
97
|
+
*/
|
|
98
|
+
inlineImages?: InlineImages;
|
|
91
99
|
/**
|
|
92
100
|
* A set of trigger characters
|
|
93
101
|
*
|
|
@@ -52,6 +52,58 @@ export interface ImageInserter {
|
|
|
52
52
|
*/
|
|
53
53
|
insertFailedThumbnail: () => void;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Configures inline image support in the editor. The editor owns the paste
|
|
57
|
+
* lifecycle (thumbnail → upload → resizable image or failed state). Choose how
|
|
58
|
+
* images are persisted with one of two shapes: `InlineImageTag` (a custom
|
|
59
|
+
* id-carrying element) or `InlineImageSrc` (a plain `<img>`).
|
|
60
|
+
*
|
|
61
|
+
* @alpha
|
|
62
|
+
*/
|
|
63
|
+
export type InlineImages = InlineImageTag | InlineImageSrc;
|
|
64
|
+
/**
|
|
65
|
+
* Persists images as `<tagName image-id="…">`, carrying only an id; the editor
|
|
66
|
+
* resolves it to a displayable src via `getUrl`. Portable — no URL is baked
|
|
67
|
+
* into the stored content.
|
|
68
|
+
*
|
|
69
|
+
* @alpha
|
|
70
|
+
*/
|
|
71
|
+
export interface InlineImageTag {
|
|
72
|
+
/**
|
|
73
|
+
* Custom element the image is persisted as, e.g. `my-image`. Not a built-in
|
|
74
|
+
* tag like `img` — use the {@link InlineImageSrc} shape for plain `<img>`.
|
|
75
|
+
*/
|
|
76
|
+
tagName: `${string}-${string}`;
|
|
77
|
+
/**
|
|
78
|
+
* Resolves a stored id to a displayable src URL. The id originates from
|
|
79
|
+
* stored, potentially untrusted content and is only checked for
|
|
80
|
+
* non-emptiness before it reaches here, so validate it before using it to
|
|
81
|
+
* build a backend URL.
|
|
82
|
+
*/
|
|
83
|
+
getUrl: (id: string) => string;
|
|
84
|
+
/**
|
|
85
|
+
* Uploads a pasted image, resolving to the stored id. Omit to render and
|
|
86
|
+
* round-trip existing images without allowing new pastes.
|
|
87
|
+
*/
|
|
88
|
+
upload?: (file: File) => Promise<string>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Persists images as a plain `<img src="…">`.
|
|
92
|
+
*
|
|
93
|
+
* @alpha
|
|
94
|
+
*/
|
|
95
|
+
export interface InlineImageSrc {
|
|
96
|
+
/** Uploads a pasted image, resolving to its src — a URL or a data URI. */
|
|
97
|
+
upload: (file: File) => Promise<string>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Narrows `InlineImages` to its tag shape, exposing `tagName`/`getUrl`.
|
|
101
|
+
*
|
|
102
|
+
* @param config - the inline-images configuration to test
|
|
103
|
+
* @returns whether images are persisted as a custom id-carrying element
|
|
104
|
+
* @alpha
|
|
105
|
+
*/
|
|
106
|
+
export declare function isInlineImageTag(config: InlineImages): config is InlineImageTag;
|
|
55
107
|
/**
|
|
56
108
|
* @alpha
|
|
57
109
|
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EditorView } from 'prosemirror-view';
|
|
2
2
|
import { Schema } from 'prosemirror-model';
|
|
3
|
+
import { CustomElementDefinition } from '../../../global/shared-types/custom-element.types';
|
|
4
|
+
import { InlineImages } from '../text-editor.types';
|
|
3
5
|
/**
|
|
4
6
|
* Abstract class implementing a generic parser/serialiser
|
|
5
7
|
* for different editor content types
|
|
@@ -12,4 +14,14 @@ export interface ContentTypeConverter {
|
|
|
12
14
|
parseAsHTML: (text: string, schema: Schema) => Promise<string>;
|
|
13
15
|
serialize: (view: EditorView, schema: Schema) => string;
|
|
14
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Build the sanitization whitelist for editor content: the consumer's custom
|
|
19
|
+
* elements, plus (when inline images are configured) the inline-image tag so it
|
|
20
|
+
* survives parsing into an image node. Shared by all content converters.
|
|
21
|
+
*
|
|
22
|
+
* @param customNodes
|
|
23
|
+
* @param inlineImages
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildContentWhitelist(customNodes: CustomElementDefinition[], inlineImages?: InlineImages): CustomElementDefinition[];
|
|
15
27
|
//# sourceMappingURL=content-type-converter.d.ts.map
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ContentTypeConverter } from './content-type-converter';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
3
|
import { CustomElementDefinition } from '../../../interface';
|
|
4
|
+
import { InlineImages } from '../text-editor.types';
|
|
4
5
|
/**
|
|
5
6
|
* @private
|
|
6
7
|
*/
|
|
7
8
|
export declare class HTMLConverter implements ContentTypeConverter {
|
|
8
9
|
private customNodes;
|
|
9
|
-
|
|
10
|
+
private readonly inlineImages?;
|
|
11
|
+
constructor(plugins: CustomElementDefinition[], inlineImages?: InlineImages);
|
|
10
12
|
parseAsHTML: (text: string) => Promise<string>;
|
|
11
13
|
serialize: (view: EditorView) => string;
|
|
12
14
|
}
|
|
@@ -2,13 +2,15 @@ import { ContentTypeConverter } from './content-type-converter';
|
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
3
|
import { CustomElementDefinition } from '../../../global/shared-types/custom-element.types';
|
|
4
4
|
import { Languages } from '../../date-picker/date.types';
|
|
5
|
+
import { InlineImages } from '../text-editor.types';
|
|
5
6
|
/**
|
|
6
7
|
* @private
|
|
7
8
|
*/
|
|
8
9
|
export declare class MarkdownConverter implements ContentTypeConverter {
|
|
9
10
|
private markdownSerializer;
|
|
10
11
|
private customNodes;
|
|
11
|
-
|
|
12
|
+
private readonly inlineImages?;
|
|
13
|
+
constructor(plugins: CustomElementDefinition[], language: Languages, inlineImages?: InlineImages);
|
|
12
14
|
parseAsHTML: (text: string) => Promise<string>;
|
|
13
15
|
serialize: (view: EditorView) => string;
|
|
14
16
|
}
|
|
@@ -44,7 +44,7 @@ import { Searcher } from "./components/picker/searcher.types";
|
|
|
44
44
|
import { ActionPosition, ActionScrollBehavior } from "./components/picker/actions.types";
|
|
45
45
|
import { ResizeOptions } from "./util/image-resize";
|
|
46
46
|
import { FlowItem } from "./components/progress-flow/progress-flow.types";
|
|
47
|
-
import { EditorImage, EditorMetadata, ImageInserter, TriggerCharacter, TriggerEventDetail } from "./components/text-editor/text-editor.types";
|
|
47
|
+
import { EditorImage, EditorMetadata, ImageInserter, InlineImages, TriggerCharacter, TriggerEventDetail } from "./components/text-editor/text-editor.types";
|
|
48
48
|
import { EditorUiType } from "./components/text-editor/types";
|
|
49
49
|
import { Option } from "./components/select/option.types";
|
|
50
50
|
import { SpinnerSize } from "./components/spinner/spinner.types";
|
|
@@ -91,7 +91,7 @@ export { Searcher } from "./components/picker/searcher.types";
|
|
|
91
91
|
export { ActionPosition, ActionScrollBehavior } from "./components/picker/actions.types";
|
|
92
92
|
export { ResizeOptions } from "./util/image-resize";
|
|
93
93
|
export { FlowItem } from "./components/progress-flow/progress-flow.types";
|
|
94
|
-
export { EditorImage, EditorMetadata, ImageInserter, TriggerCharacter, TriggerEventDetail } from "./components/text-editor/text-editor.types";
|
|
94
|
+
export { EditorImage, EditorMetadata, ImageInserter, InlineImages, TriggerCharacter, TriggerEventDetail } from "./components/text-editor/text-editor.types";
|
|
95
95
|
export { EditorUiType } from "./components/text-editor/types";
|
|
96
96
|
export { Option } from "./components/select/option.types";
|
|
97
97
|
export { SpinnerSize } from "./components/spinner/spinner.types";
|
|
@@ -1602,6 +1602,7 @@ export namespace Components {
|
|
|
1602
1602
|
* @exampleComponent limel-example-file-per-file-loading
|
|
1603
1603
|
* @exampleComponent limel-example-file-per-file-progress
|
|
1604
1604
|
* @exampleComponent limel-example-file-per-file-invalid
|
|
1605
|
+
* @exampleComponent limel-example-file-per-file-status
|
|
1605
1606
|
* @exampleComponent limel-example-file-menu-items
|
|
1606
1607
|
* @exampleComponent limel-example-file-accepted-types
|
|
1607
1608
|
* @exampleComponent limel-example-file-composite
|
|
@@ -3198,6 +3199,12 @@ export namespace Components {
|
|
|
3198
3199
|
* Emits any pending debounced `change` event immediately. Does nothing if no change is pending.
|
|
3199
3200
|
*/
|
|
3200
3201
|
"flushPendingChanges": () => Promise<void>;
|
|
3202
|
+
/**
|
|
3203
|
+
* Configures inline image support. When set, the editor owns the paste + upload lifecycle and persists images either as the configured tag carrying only a file id (`InlineImageTag`), or as a plain `<img src>` (`InlineImageSrc`).
|
|
3204
|
+
* @private
|
|
3205
|
+
* @alpha
|
|
3206
|
+
*/
|
|
3207
|
+
"inlineImages"?: InlineImages;
|
|
3201
3208
|
/**
|
|
3202
3209
|
* Defines the language for translations.
|
|
3203
3210
|
*/
|
|
@@ -3809,8 +3816,8 @@ export namespace Components {
|
|
|
3809
3816
|
* @exampleComponent limel-example-text-editor-with-markdown
|
|
3810
3817
|
* @exampleComponent limel-example-text-editor-with-html
|
|
3811
3818
|
* @exampleComponent limel-example-text-editor-with-tables
|
|
3812
|
-
* @exampleComponent limel-example-text-editor-with-inline-images-file-storage
|
|
3813
3819
|
* @exampleComponent limel-example-text-editor-with-inline-images-base64
|
|
3820
|
+
* @exampleComponent limel-example-text-editor-with-inline-images-custom-tag
|
|
3814
3821
|
* @exampleComponent limel-example-text-editor-allow-resize
|
|
3815
3822
|
* @exampleComponent limel-example-text-editor-size
|
|
3816
3823
|
* @exampleComponent limel-example-text-editor-ui
|
|
@@ -3854,6 +3861,12 @@ export namespace Components {
|
|
|
3854
3861
|
* Optional helper text to display below the input field when it has focus
|
|
3855
3862
|
*/
|
|
3856
3863
|
"helperText"?: string;
|
|
3864
|
+
/**
|
|
3865
|
+
* Configures inline image support: the editor owns the paste lifecycle and resize, the consumer owns upload, storage format, and URL resolution.
|
|
3866
|
+
* @private
|
|
3867
|
+
* @alpha
|
|
3868
|
+
*/
|
|
3869
|
+
"inlineImages"?: InlineImages;
|
|
3857
3870
|
/**
|
|
3858
3871
|
* Set to `true` to indicate that the current value of the editor is invalid.
|
|
3859
3872
|
* @default false
|
|
@@ -5115,6 +5128,7 @@ declare global {
|
|
|
5115
5128
|
* @exampleComponent limel-example-file-per-file-loading
|
|
5116
5129
|
* @exampleComponent limel-example-file-per-file-progress
|
|
5117
5130
|
* @exampleComponent limel-example-file-per-file-invalid
|
|
5131
|
+
* @exampleComponent limel-example-file-per-file-status
|
|
5118
5132
|
* @exampleComponent limel-example-file-menu-items
|
|
5119
5133
|
* @exampleComponent limel-example-file-accepted-types
|
|
5120
5134
|
* @exampleComponent limel-example-file-composite
|
|
@@ -6418,8 +6432,8 @@ declare global {
|
|
|
6418
6432
|
* @exampleComponent limel-example-text-editor-with-markdown
|
|
6419
6433
|
* @exampleComponent limel-example-text-editor-with-html
|
|
6420
6434
|
* @exampleComponent limel-example-text-editor-with-tables
|
|
6421
|
-
* @exampleComponent limel-example-text-editor-with-inline-images-file-storage
|
|
6422
6435
|
* @exampleComponent limel-example-text-editor-with-inline-images-base64
|
|
6436
|
+
* @exampleComponent limel-example-text-editor-with-inline-images-custom-tag
|
|
6423
6437
|
* @exampleComponent limel-example-text-editor-allow-resize
|
|
6424
6438
|
* @exampleComponent limel-example-text-editor-size
|
|
6425
6439
|
* @exampleComponent limel-example-text-editor-ui
|
|
@@ -8206,6 +8220,7 @@ declare namespace LocalJSX {
|
|
|
8206
8220
|
* @exampleComponent limel-example-file-per-file-loading
|
|
8207
8221
|
* @exampleComponent limel-example-file-per-file-progress
|
|
8208
8222
|
* @exampleComponent limel-example-file-per-file-invalid
|
|
8223
|
+
* @exampleComponent limel-example-file-per-file-status
|
|
8209
8224
|
* @exampleComponent limel-example-file-menu-items
|
|
8210
8225
|
* @exampleComponent limel-example-file-accepted-types
|
|
8211
8226
|
* @exampleComponent limel-example-file-composite
|
|
@@ -9886,6 +9901,12 @@ declare namespace LocalJSX {
|
|
|
9886
9901
|
* @default false
|
|
9887
9902
|
*/
|
|
9888
9903
|
"disabled"?: boolean;
|
|
9904
|
+
/**
|
|
9905
|
+
* Configures inline image support. When set, the editor owns the paste + upload lifecycle and persists images either as the configured tag carrying only a file id (`InlineImageTag`), or as a plain `<img src>` (`InlineImageSrc`).
|
|
9906
|
+
* @private
|
|
9907
|
+
* @alpha
|
|
9908
|
+
*/
|
|
9909
|
+
"inlineImages"?: InlineImages;
|
|
9889
9910
|
/**
|
|
9890
9911
|
* Defines the language for translations.
|
|
9891
9912
|
*/
|
|
@@ -10582,8 +10603,8 @@ declare namespace LocalJSX {
|
|
|
10582
10603
|
* @exampleComponent limel-example-text-editor-with-markdown
|
|
10583
10604
|
* @exampleComponent limel-example-text-editor-with-html
|
|
10584
10605
|
* @exampleComponent limel-example-text-editor-with-tables
|
|
10585
|
-
* @exampleComponent limel-example-text-editor-with-inline-images-file-storage
|
|
10586
10606
|
* @exampleComponent limel-example-text-editor-with-inline-images-base64
|
|
10607
|
+
* @exampleComponent limel-example-text-editor-with-inline-images-custom-tag
|
|
10587
10608
|
* @exampleComponent limel-example-text-editor-allow-resize
|
|
10588
10609
|
* @exampleComponent limel-example-text-editor-size
|
|
10589
10610
|
* @exampleComponent limel-example-text-editor-ui
|
|
@@ -10619,6 +10640,12 @@ declare namespace LocalJSX {
|
|
|
10619
10640
|
* Optional helper text to display below the input field when it has focus
|
|
10620
10641
|
*/
|
|
10621
10642
|
"helperText"?: string;
|
|
10643
|
+
/**
|
|
10644
|
+
* Configures inline image support: the editor owns the paste lifecycle and resize, the consumer owns upload, storage format, and URL resolution.
|
|
10645
|
+
* @private
|
|
10646
|
+
* @alpha
|
|
10647
|
+
*/
|
|
10648
|
+
"inlineImages"?: InlineImages;
|
|
10622
10649
|
/**
|
|
10623
10650
|
* Set to `true` to indicate that the current value of the editor is invalid.
|
|
10624
10651
|
* @default false
|
|
@@ -12055,6 +12082,7 @@ declare module "@stencil/core" {
|
|
|
12055
12082
|
* @exampleComponent limel-example-file-per-file-loading
|
|
12056
12083
|
* @exampleComponent limel-example-file-per-file-progress
|
|
12057
12084
|
* @exampleComponent limel-example-file-per-file-invalid
|
|
12085
|
+
* @exampleComponent limel-example-file-per-file-status
|
|
12058
12086
|
* @exampleComponent limel-example-file-menu-items
|
|
12059
12087
|
* @exampleComponent limel-example-file-accepted-types
|
|
12060
12088
|
* @exampleComponent limel-example-file-composite
|
|
@@ -12809,8 +12837,8 @@ declare module "@stencil/core" {
|
|
|
12809
12837
|
* @exampleComponent limel-example-text-editor-with-markdown
|
|
12810
12838
|
* @exampleComponent limel-example-text-editor-with-html
|
|
12811
12839
|
* @exampleComponent limel-example-text-editor-with-tables
|
|
12812
|
-
* @exampleComponent limel-example-text-editor-with-inline-images-file-storage
|
|
12813
12840
|
* @exampleComponent limel-example-text-editor-with-inline-images-base64
|
|
12841
|
+
* @exampleComponent limel-example-text-editor-with-inline-images-custom-tag
|
|
12814
12842
|
* @exampleComponent limel-example-text-editor-allow-resize
|
|
12815
12843
|
* @exampleComponent limel-example-text-editor-size
|
|
12816
12844
|
* @exampleComponent limel-example-text-editor-ui
|
|
@@ -87,6 +87,16 @@ export interface FileInfo {
|
|
|
87
87
|
* upload, as a percentage. Must be a number between `0` and `100`.
|
|
88
88
|
*/
|
|
89
89
|
progress?: number;
|
|
90
|
+
/**
|
|
91
|
+
* A short label describing the file's current state, such as
|
|
92
|
+
* `Uploading…`, `Scanning for viruses…` or `Failed`. When set, it replaces
|
|
93
|
+
* the file size badge on the chip, and is read by assistive technologies as
|
|
94
|
+
* part of the chip's accessible name.
|
|
95
|
+
*
|
|
96
|
+
* Prefer `progress` for a measurable value like a percentage, so it is
|
|
97
|
+
* shown as a progress bar instead of rapidly-changing text.
|
|
98
|
+
*/
|
|
99
|
+
statusText?: string;
|
|
90
100
|
/**
|
|
91
101
|
* Set to `true` to mark the file as invalid, rendering it in an error
|
|
92
102
|
* state. This is independent of the component's own `invalid` state.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as r}from"./p-BGxJfR2f.js";import{c as o}from"./p-JbKhhoXs.js";const l=class{constructor(r){t(this,r),this.change=e(this,"change"),this.imagePasted=e(this,"imagePasted"),this.imageRemoved=e(this,"imageRemoved"),this.metadataChange=e(this,"metadataChange"),this.triggerStart=e(this,"triggerStart"),this.triggerStop=e(this,"triggerStop"),this.triggerChange=e(this,"triggerChange"),this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.customElements=[],this.triggers=[],this.required=!1,this.allowResize=!0,this.ui="standard",this.renderHelperLine=()=>{if(this.helperText)return i("limel-helper-line",{helperText:this.helperText,helperTextId:this.helperTextId,invalid:this.isInvalid()})},this.isInvalid=()=>!this.readonly&&(!!this.invalid||void 0),this.handleChange=t=>{t.stopPropagation(),this.change.emit(t.detail)},this.handleImagePasted=t=>{t.stopPropagation(),this.imagePasted.emit(t.detail)},this.handleMetadataChange=t=>{t.stopPropagation(),this.metadataChange.emit(t.detail)},this.handleImageRemoved=t=>{t.stopPropagation(),this.imageRemoved.emit(t.detail)},this.helperTextId=o(),this.editorId=o()}async flushPendingChanges(){var t;await(null===(t=this.adapterElement)||void 0===t?void 0:t.flushPendingChanges())}async clear(){var t;await(null===(t=this.adapterElement)||void 0===t?void 0:t.clear())}render(){return i(r,{key:"12f7643f82a4899efd112dc74e67fbd79be64d9f"},i("limel-notched-outline",{key:"109e7c03874e141f073a05882ca48188adaced72",labelId:this.editorId,label:this.label,required:this.required,invalid:this.invalid,disabled:this.disabled,readonly:this.readonly,hasValue:!!this.value,hasFloatingLabel:!0},this.renderEditor(),this.renderPlaceholder()),this.renderHelperLine())}renderEditor(){return this.readonly?i("limel-markdown",{slot:"content",value:this.value,"aria-controls":this.helperText?this.helperTextId:void 0,id:this.editorId}):i("limel-prosemirror-adapter",{ref:t=>this.adapterElement=t,slot:"content","aria-placeholder":this.placeholder,contentType:this.contentType,onChange:this.handleChange,onImagePasted:this.handleImagePasted,onImageRemoved:this.handleImageRemoved,onMetadataChange:this.handleMetadataChange,customElements:this.customElements,value:this.value,"aria-controls":this.helperText?this.helperTextId:void 0,id:this.editorId,"aria-disabled":this.disabled,"aria-invalid":this.invalid,"aria-required":this.required,language:this.language,triggerCharacters:this.triggers,disabled:this.disabled,ui:this.ui})}renderPlaceholder(){if(this.placeholder&&!this.value)return i("span",{class:"placeholder","aria-hidden":"true",slot:"content"},this.placeholder)}static get delegatesFocus(){return!0}};l.style='@charset "UTF-8";*{box-sizing:border-box}:host(limel-text-editor){--limel-notched-outline-z-index:2;--limel-prosemirror-adapter-toolbar-opacity:0.6;--limel-text-editor-padding:0.25rem 1rem 0.75rem 1rem;--limel-prosemirror-adapter-toolbar-grid-template-rows:1fr;--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration:0.3s;--limel-prosemirror-adapter-toolbar-transition-timing-function:cubic-bezier( 0.19, 0.23, 0.26, 0.89 );position:relative;isolation:isolate;display:flex;flex-direction:column;width:100%;min-width:5rem;min-height:5rem;height:100%;max-height:var(--text-editor-max-height, calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem));padding:1px}:host(limel-text-editor) limel-notched-outline{height:100%}:host(limel-text-editor:focus-within),:host(limel-text-editor:not([ui=minimal]):hover){--limel-prosemirror-adapter-toolbar-opacity:1}:host(limel-text-editor[ui=minimal]:not(:focus-within)){--limel-prosemirror-adapter-toolbar-grid-template-rows:0fr;--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration:0.46s;--limel-prosemirror-adapter-action-bar-padding-top-bottom:0;--limel-prosemirror-adapter-toolbar-opacity:0}:host(limel-text-editor[ui=minimal]:not(:focus-within)),:host(limel-text-editor[ui=no-toolbar]){--limel-text-editor-padding:0.75rem 1rem 0.75rem 1rem;--limel-text-editor-placeholder-top:0;min-height:2.5rem}:host(limel-text-editor[ui=minimal]:not(:focus-within)) limel-prosemirror-adapter,:host(limel-text-editor[ui=no-toolbar]) limel-prosemirror-adapter{min-height:2.5rem}:host(limel-text-editor:focus-within) .placeholder,:host(limel-text-editor:focus) .placeholder{opacity:0}:host(limel-text-editor[disabled]:not([disabled=false])) limel-prosemirror-adapter{cursor:not-allowed;opacity:0.4;pointer-events:none}:host(limel-text-editor[readonly]:not([readonly=false])){--limel-text-editor-padding:0.75rem 1rem 0.75rem 1rem;--limel-text-editor-placeholder-top:0}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown{display:block;padding:var(--limel-text-editor-padding);overflow-y:auto;-webkit-overflow-scrolling:touch;height:100%}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:before,:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:after{z-index:1;pointer-events:none;content:"";display:block;position:absolute;width:100%}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:after{height:1.75rem;top:0;background:linear-gradient(var(--text-editor-fade-out-background-color, rgb(var(--contrast-100))), transparent)}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:before{height:2rem;bottom:-0.25rem;background:linear-gradient(transparent, var(--text-editor-fade-out-background-color, rgb(var(--contrast-100))))}.placeholder{transition-property:top;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;position:absolute;top:var(--limel-text-editor-placeholder-top, 2.25rem);left:0;right:0;padding:var(--limel-text-editor-padding);font-style:italic;font-size:var(--limel-theme-default-font-size);color:rgb(var(--contrast-900))}limel-prosemirror-adapter{flex-grow:1;min-width:0;min-height:5rem;height:100%;max-height:100%;overflow:hidden auto;-webkit-overflow-scrolling:touch}:host(limel-text-editor:focus),:host(limel-text-editor:focus-visible),:host(limel-text-editor:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limel-text-editor){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limel-text-editor:focus) limel-helper-line,:host(limel-text-editor:focus-visible) limel-helper-line,:host(limel-text-editor:focus-within) limel-helper-line,:host(limel-text-editor:hover) limel-helper-line{will-change:grid-template-rows}:host(limel-text-editor[allow-resize]) limel-prosemirror-adapter{resize:vertical}';export{l as limel_text_editor}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={Bold:"strong",Italic:"em",Blockquote:"blockquote",HeaderLevel1:"headerlevel1",HeaderLevel2:"headerlevel2",HeaderLevel3:"headerlevel3",Link:"link",OrderedList:"ordered_list",BulletList:"bullet_list",Strikethrough:"strikethrough",Code:"code",CodeBlock:"code_block"},l=Object.values(e),t={Heading:"heading",one:1,two:2,three:3},d={Left:0,Middle:1,Right:2};export{e as E,t as L,d as M,l as e}
|