@limetech/lime-elements 38.11.0 → 38.12.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 (76) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/index.cjs.js +0 -9
  3. package/dist/cjs/index.cjs.js.map +1 -1
  4. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +209 -111
  5. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
  6. package/dist/cjs/limel-snackbar.cjs.entry.js.map +1 -1
  7. package/dist/cjs/limel-text-editor.cjs.entry.js +7 -1
  8. package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
  9. package/dist/collection/components/snackbar/snackbar.js +1 -1
  10. package/dist/collection/components/snackbar/snackbar.js.map +1 -1
  11. package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-items.js.map +1 -1
  12. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/inserter.js +15 -54
  13. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/inserter.js.map +1 -1
  14. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/node.js +52 -44
  15. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/node.js.map +1 -1
  16. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/view.js +11 -13
  17. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/view.js.map +1 -1
  18. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/link-plugin.js.map +1 -1
  19. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/append-transaction-handler.js.map +1 -1
  20. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/detect-trigger-removal.js.map +1 -1
  21. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/get-trigger-event-detail.js.map +1 -1
  22. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/monitor-triggered-text.js.map +1 -1
  23. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/send-trigger-event.js.map +1 -1
  24. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/text-input-handler.js.map +1 -1
  25. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/factory.js.map +1 -1
  26. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/inserter.js.map +1 -1
  27. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +54 -8
  28. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
  29. package/dist/collection/components/text-editor/text-editor.js +38 -4
  30. package/dist/collection/components/text-editor/text-editor.js.map +1 -1
  31. package/dist/collection/components/text-editor/text-editor.types.js +1 -9
  32. package/dist/collection/components/text-editor/text-editor.types.js.map +1 -1
  33. package/dist/collection/components/text-editor/utils/metadata-utils.js +108 -0
  34. package/dist/collection/components/text-editor/utils/metadata-utils.js.map +1 -0
  35. package/dist/esm/index.js +0 -2
  36. package/dist/esm/index.js.map +1 -1
  37. package/dist/esm/limel-prosemirror-adapter.entry.js +209 -111
  38. package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
  39. package/dist/esm/limel-snackbar.entry.js.map +1 -1
  40. package/dist/esm/limel-text-editor.entry.js +7 -1
  41. package/dist/esm/limel-text-editor.entry.js.map +1 -1
  42. package/dist/lime-elements/index.esm.js +1 -1
  43. package/dist/lime-elements/index.esm.js.map +1 -1
  44. package/dist/lime-elements/lime-elements.esm.js +1 -1
  45. package/dist/lime-elements/p-3a87b175.entry.js.map +1 -1
  46. package/dist/lime-elements/p-7b039dab.entry.js +2 -0
  47. package/dist/lime-elements/p-7b039dab.entry.js.map +1 -0
  48. package/dist/lime-elements/{p-033fa919.entry.js → p-7f3045bd.entry.js} +2 -2
  49. package/dist/lime-elements/p-7f3045bd.entry.js.map +1 -0
  50. package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-items.d.ts +2 -2
  51. package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/inserter.d.ts +2 -7
  52. package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/node.d.ts +9 -0
  53. package/dist/types/components/text-editor/prosemirror-adapter/plugins/link-plugin.d.ts +0 -4
  54. package/dist/types/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/append-transaction-handler.d.ts +1 -1
  55. package/dist/types/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/detect-trigger-removal.d.ts +1 -1
  56. package/dist/types/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/get-trigger-event-detail.d.ts +2 -2
  57. package/dist/types/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/monitor-triggered-text.d.ts +2 -2
  58. package/dist/types/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/send-trigger-event.d.ts +1 -1
  59. package/dist/types/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/text-input-handler.d.ts +1 -1
  60. package/dist/types/components/text-editor/prosemirror-adapter/plugins/trigger/factory.d.ts +1 -1
  61. package/dist/types/components/text-editor/prosemirror-adapter/plugins/trigger/inserter.d.ts +1 -1
  62. package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +10 -0
  63. package/dist/types/components/text-editor/text-editor.d.ts +10 -0
  64. package/dist/types/components/text-editor/text-editor.types.d.ts +32 -7
  65. package/dist/types/components/text-editor/utils/metadata-utils.d.ts +22 -0
  66. package/dist/types/components.d.ts +17 -4
  67. package/package.json +1 -1
  68. package/dist/cjs/text-editor.types-5e5567e2.js +0 -13
  69. package/dist/cjs/text-editor.types-5e5567e2.js.map +0 -1
  70. package/dist/esm/text-editor.types-e82469d1.js +0 -13
  71. package/dist/esm/text-editor.types-e82469d1.js.map +0 -1
  72. package/dist/lime-elements/p-033fa919.entry.js.map +0 -1
  73. package/dist/lime-elements/p-7006fafe.entry.js +0 -2
  74. package/dist/lime-elements/p-7006fafe.entry.js.map +0 -1
  75. package/dist/lime-elements/p-9ca516ed.js +0 -2
  76. package/dist/lime-elements/p-9ca516ed.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as e,c as t,h as r,H as i}from"./p-288f0842.js";import{c as o}from"./p-96460db3.js";const l='@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 )}*{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(\n 0.19,\n 0.23,\n 0.26,\n 0.89\n );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: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:0.875rem;color:rgb(var(--contrast-900))}limel-prosemirror-adapter{flex-grow:1;min-width:0;min-height:5rem;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}';const a=class{constructor(i){e(this,i);this.change=t(this,"change",7);this.imagePasted=t(this,"imagePasted",7);this.imageRemoved=t(this,"imageRemoved",7);this.triggerStart=t(this,"triggerStart",7);this.triggerStop=t(this,"triggerStop",7);this.triggerChange=t(this,"triggerChange",7);this.renderHelperLine=()=>{if(!this.helperText){return}return r("limel-helper-line",{helperText:this.helperText,helperTextId:this.helperTextId,invalid:this.isInvalid()})};this.isInvalid=()=>{if(this.readonly){return false}if(this.invalid){return true}};this.handleChange=e=>{e.stopPropagation();this.change.emit(e.detail)};this.handleImagePasted=e=>{e.stopPropagation();this.imagePasted.emit(e.detail)};this.handleImageRemoved=e=>{e.stopPropagation();this.imageRemoved.emit(e.detail)};this.contentType="markdown";this.language="en";this.disabled=false;this.readonly=false;this.helperText=undefined;this.placeholder=undefined;this.label=undefined;this.invalid=false;this.value=undefined;this.customElements=[];this.triggers=[];this.required=false;this.allowResize=true;this.ui="standard";this.helperTextId=o();this.editorId=o()}render(){return r(i,null,r("limel-notched-outline",{labelId:this.editorId,label:this.label,required:this.required,invalid:this.invalid,disabled:this.disabled,readonly:this.readonly,hasValue:!!this.value,hasFloatingLabel:true},this.renderEditor(),this.renderPlaceholder()),this.renderHelperLine())}renderEditor(){if(this.readonly){return r("limel-markdown",{slot:"content",value:this.value,"aria-controls":this.helperTextId,id:this.editorId})}return r("limel-prosemirror-adapter",{slot:"content","aria-placeholder":this.placeholder,contentType:this.contentType,onChange:this.handleChange,onImagePasted:this.handleImagePasted,onImageRemoved:this.handleImageRemoved,customElements:this.customElements,value:this.value,"aria-controls":this.helperTextId,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}return r("span",{class:"placeholder","aria-hidden":"true",slot:"content"},this.placeholder)}static get delegatesFocus(){return true}};a.style=l;export{a as limel_text_editor};
2
- //# sourceMappingURL=p-033fa919.entry.js.map
1
+ import{r as e,c as t,h as r,H as i}from"./p-288f0842.js";import{c as o}from"./p-96460db3.js";const l='@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 )}*{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(\n 0.19,\n 0.23,\n 0.26,\n 0.89\n );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: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:0.875rem;color:rgb(var(--contrast-900))}limel-prosemirror-adapter{flex-grow:1;min-width:0;min-height:5rem;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}';const a=class{constructor(i){e(this,i);this.change=t(this,"change",7);this.imagePasted=t(this,"imagePasted",7);this.imageRemoved=t(this,"imageRemoved",7);this.metadataChange=t(this,"metadataChange",7);this.triggerStart=t(this,"triggerStart",7);this.triggerStop=t(this,"triggerStop",7);this.triggerChange=t(this,"triggerChange",7);this.renderHelperLine=()=>{if(!this.helperText){return}return r("limel-helper-line",{helperText:this.helperText,helperTextId:this.helperTextId,invalid:this.isInvalid()})};this.isInvalid=()=>{if(this.readonly){return false}if(this.invalid){return true}};this.handleChange=e=>{e.stopPropagation();this.change.emit(e.detail)};this.handleImagePasted=e=>{e.stopPropagation();this.imagePasted.emit(e.detail)};this.handleMetadataChange=e=>{e.stopPropagation();this.metadataChange.emit(e.detail)};this.handleImageRemoved=e=>{e.stopPropagation();this.imageRemoved.emit(e.detail)};this.contentType="markdown";this.language="en";this.disabled=false;this.readonly=false;this.helperText=undefined;this.placeholder=undefined;this.label=undefined;this.invalid=false;this.value=undefined;this.customElements=[];this.triggers=[];this.required=false;this.allowResize=true;this.ui="standard";this.helperTextId=o();this.editorId=o()}render(){return r(i,null,r("limel-notched-outline",{labelId:this.editorId,label:this.label,required:this.required,invalid:this.invalid,disabled:this.disabled,readonly:this.readonly,hasValue:!!this.value,hasFloatingLabel:true},this.renderEditor(),this.renderPlaceholder()),this.renderHelperLine())}renderEditor(){if(this.readonly){return r("limel-markdown",{slot:"content",value:this.value,"aria-controls":this.helperTextId,id:this.editorId})}return r("limel-prosemirror-adapter",{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.helperTextId,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}return r("span",{class:"placeholder","aria-hidden":"true",slot:"content"},this.placeholder)}static get delegatesFocus(){return true}};a.style=l;export{a as limel_text_editor};
2
+ //# sourceMappingURL=p-7f3045bd.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["textEditorCss","TextEditor","constructor","hostRef","this","renderHelperLine","helperText","h","helperTextId","invalid","isInvalid","readonly","handleChange","event","stopPropagation","change","emit","detail","handleImagePasted","imagePasted","handleMetadataChange","metadataChange","handleImageRemoved","imageRemoved","createRandomString","editorId","render","Host","labelId","label","required","disabled","hasValue","value","hasFloatingLabel","renderEditor","renderPlaceholder","slot","id","placeholder","contentType","onChange","onImagePasted","onImageRemoved","onMetadataChange","customElements","language","triggerCharacters","triggers","ui","class"],"sources":["./src/components/text-editor/text-editor.scss?tag=limel-text-editor&encapsulation=shadow","./src/components/text-editor/text-editor.tsx"],"sourcesContent":["@use '../../style/internal/shared_input-select-picker';\n@use '../../style/mixins.scss';\n\n/**\n * @prop --text-editor-max-height: the tallest height the text editor can become when auto-resizing itself. Defaults to `calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem)`.\n * @prop --text-editor-fade-out-background-color: the color of the fade-out effect at the top and bottom of the text editor, when the text-editor is in readonly state. Defaults to rgb(var(--contrast-100)).\n */\n\n* {\n box-sizing: border-box;\n}\n\n$min-height: 5rem;\n$min-height-condensed: calc($min-height / 2);\n\n:host(limel-text-editor) {\n --limel-notched-outline-z-index: 2; // since `div.toolbar` has `z-index: 1;`\n --limel-prosemirror-adapter-toolbar-opacity: 0.6;\n --limel-text-editor-padding: 0.25rem 1rem 0.75rem 1rem;\n --limel-prosemirror-adapter-toolbar-grid-template-rows: 1fr;\n --limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration: 0.3s;\n --limel-prosemirror-adapter-toolbar-transition-timing-function: cubic-bezier(\n 0.19,\n 0.23,\n 0.26,\n 0.89\n );\n\n position: relative;\n isolation: isolate;\n display: flex;\n flex-direction: column;\n\n width: 100%;\n min-width: 5rem;\n min-height: $min-height;\n height: 100%;\n max-height: var(\n --text-editor-max-height,\n calc(\n 100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) -\n 4rem\n )\n );\n padding: 1px; // prevents visual defects that can appear due to the backdrop-filter and closeness to borders\n}\n\n:host(limel-text-editor:focus-within),\n:host(limel-text-editor:not([ui='minimal']):hover) {\n --limel-prosemirror-adapter-toolbar-opacity: 1;\n}\n\n:host(limel-text-editor[ui='minimal']:not(:focus-within)) {\n --limel-prosemirror-adapter-toolbar-grid-template-rows: 0fr;\n --limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration: 0.46s;\n --limel-prosemirror-adapter-action-bar-padding-top-bottom: 0;\n --limel-prosemirror-adapter-toolbar-opacity: 0;\n}\n\n:host(limel-text-editor[ui='minimal']:not(:focus-within)),\n:host(limel-text-editor[ui='no-toolbar']) {\n --limel-text-editor-padding: 0.75rem 1rem 0.75rem 1rem;\n --limel-text-editor-placeholder-top: 0;\n\n min-height: $min-height-condensed;\n limel-prosemirror-adapter {\n min-height: $min-height-condensed;\n }\n}\n\n:host(limel-text-editor:focus-within),\n:host(limel-text-editor:focus) {\n .placeholder {\n opacity: 0;\n }\n}\n\n:host(limel-text-editor[disabled]:not([disabled='false'])) {\n limel-prosemirror-adapter {\n @include shared_input-select-picker.looks-disabled;\n pointer-events: none;\n }\n}\n\n:host(limel-text-editor[readonly]:not([readonly='false'])) {\n --limel-text-editor-padding: 0.75rem 1rem 0.75rem 1rem;\n --limel-text-editor-placeholder-top: 0;\n\n limel-markdown {\n // displayed when `readonly` instead of the adapter\n display: block;\n padding: var(--limel-text-editor-padding);\n\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n height: 100%;\n\n &:before,\n &:after {\n z-index: 1;\n pointer-events: none;\n content: '';\n display: block;\n position: absolute;\n width: 100%;\n }\n &:after {\n height: 1.75rem;\n top: 0;\n background: linear-gradient(\n var(\n --text-editor-fade-out-background-color,\n rgb(var(--contrast-100))\n ),\n transparent\n );\n }\n\n &:before {\n height: 2rem;\n bottom: -0.25rem;\n background: linear-gradient(\n transparent,\n var(\n --text-editor-fade-out-background-color,\n rgb(var(--contrast-100))\n )\n );\n }\n }\n}\n\n.placeholder {\n transition-property: top;\n transition-duration: var(\n --limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration\n );\n transition-timing-function: var(\n --limel-prosemirror-adapter-toolbar-transition-timing-function\n );\n @include mixins.truncate-text;\n pointer-events: none;\n position: absolute;\n top: var(--limel-text-editor-placeholder-top, 2.25rem);\n left: 0;\n right: 0;\n\n padding: var(--limel-text-editor-padding);\n font-style: italic;\n font-size: 0.875rem;\n color: shared_input-select-picker.$input-placeholder-color;\n}\n\nlimel-prosemirror-adapter {\n flex-grow: 1;\n\n min-width: 0;\n min-height: $min-height;\n height: 100%;\n overflow: hidden auto;\n -webkit-overflow-scrolling: touch;\n}\n\n@include mixins.hide-helper-line-when-not-needed(limel-text-editor);\n\n:host(limel-text-editor[allow-resize]) {\n limel-prosemirror-adapter {\n resize: vertical;\n }\n}\n","import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport { FormComponent } from '../form/form.types';\nimport { Languages } from '../date-picker/date.types';\nimport { createRandomString } from '../../util/random-string';\nimport { CustomElementDefinition } from '../../global/shared-types/custom-element.types';\nimport {\n TriggerCharacter,\n TriggerEventDetail,\n ImageInserter,\n EditorImage,\n EditorMetadata,\n} from './text-editor.types';\nimport { EditorUiType } from './types';\n\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-with-markdown\n * @exampleComponent limel-example-text-editor-with-html\n * @exampleComponent limel-example-text-editor-with-tables\n * @exampleComponent limel-example-text-editor-with-inline-images-file-storage\n * @exampleComponent limel-example-text-editor-with-inline-images-base64\n * @exampleComponent limel-example-text-editor-allow-resize\n * @exampleComponent limel-example-text-editor-size\n * @exampleComponent limel-example-text-editor-ui\n * @exampleComponent limel-example-text-editor-custom-element\n * @exampleComponent limel-example-text-editor-triggers\n * @exampleComponent limel-example-text-editor-composite\n * @beta\n */\n@Component({\n tag: 'limel-text-editor',\n shadow: { delegatesFocus: true },\n styleUrl: 'text-editor.scss',\n})\nexport class TextEditor implements FormComponent<string> {\n /** The type of content that the editor should handle and emit, defaults to `markdown`\n *\n * Assumed to be set only once, so not reactive to changes\n */\n @Prop()\n public contentType: 'markdown' | 'html' = 'markdown';\n\n /**\n * Defines the language for translations.\n */\n @Prop({ reflect: true })\n public language: Languages = 'en';\n\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 = false;\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 = false;\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 = false;\n\n /**\n * Description of the text inside the editor as markdown\n */\n @Prop({ reflect: true })\n public value: string;\n\n /**\n * A list of custom elements\n *\n * Any `CustomElement` that should be used inside the text editor needs\n * to be defined here.\n *\n * @private\n * @alpha\n */\n @Prop()\n public customElements: CustomElementDefinition[] = [];\n\n /**\n * A set of trigger characters\n *\n * Defining a character here will enable trigger events to be sent if the\n * character is detected in the editor.\n *\n * @private\n * @alpha\n */\n @Prop()\n public triggers: TriggerCharacter[] = [];\n\n /**\n * Set to `true` to indicate that the field is required.\n *\n * :::important\n * An empty but required field is not automatically considered invalid.\n * You must make sure to check the validity of the field on your own,\n * and properly handle the `invalid` state.\n * :::\n */\n @Prop({ reflect: true })\n public required?: boolean = false;\n\n /**\n * Set to `true` to allow the user to vertically resize the editor.\n * Set to `false` to disable the resize functionality.\n */\n @Prop({ reflect: true })\n public allowResize: boolean = true;\n\n /**\n * Specifies the visual appearance of the editor.\n *\n * - `standard`: The default editor appearance with a full toolbar and\n * standard layout.\n * - `minimal`: A compact editor appearance, ideal for limited space\n * scenarios such as mobile devices. In this mode, the toolbar is hidden\n * until the editor is focused.\n * - `no-toolbar`: A basic textarea appearance without any text styling toolbar.\n * This mode is suitable for scenarios where you want to provide a simple\n * text input without any visible formatting options; but still provide\n * support for markdown syntax and rich text, using hotkeys or when pasting.\n */\n @Prop({ reflect: true })\n public ui?: EditorUiType = 'standard';\n\n /**\n * Dispatched when a change is made to the editor\n */\n @Event()\n public change: EventEmitter<string>;\n\n /**\n * Dispatched when a image is pasted into the editor\n *\n * @private\n * @alpha\n */\n @Event()\n private readonly imagePasted: EventEmitter<ImageInserter>;\n\n /**\n * Dispatched when a image is removed from the editor\n *\n * @private\n * @alpha\n * @deprecated - This event is deprecated and will be removed in a future version.\n * Use the `metadataChange` event instead to track image removals.\n */\n @Event()\n private readonly imageRemoved: EventEmitter<EditorImage>;\n\n /**\n * Dispatched when the metadata of the editor changes\n *\n * @private\n * @alpha\n */\n @Event()\n private readonly metadataChange: EventEmitter<EditorMetadata>;\n\n /**\n * Dispatched if a trigger character is detected.\n *\n * @private\n * @alpha\n */\n @Event()\n public triggerStart: EventEmitter<TriggerEventDetail>;\n\n /**\n * Dispatched if a trigger session is ended. That is if the selection\n * goes outside the trigger input or if something is inserted using the\n * supplied `TextEditor` insert function.\n *\n * @private\n * @alpha\n */\n @Event()\n public triggerStop: EventEmitter<TriggerEventDetail>;\n\n /**\n * Dispatched if a input is changed during an active trigger.\n *\n * @private\n * @alpha\n */\n @Event()\n public triggerChange: EventEmitter<TriggerEventDetail>;\n\n private readonly helperTextId: string;\n private readonly editorId: string;\n\n public constructor() {\n this.helperTextId = createRandomString();\n this.editorId = createRandomString();\n }\n\n public render() {\n return (\n <Host>\n <limel-notched-outline\n labelId={this.editorId}\n label={this.label}\n required={this.required}\n invalid={this.invalid}\n disabled={this.disabled}\n readonly={this.readonly}\n hasValue={!!this.value}\n hasFloatingLabel={true}\n >\n {this.renderEditor()}\n {this.renderPlaceholder()}\n </limel-notched-outline>\n {this.renderHelperLine()}\n </Host>\n );\n }\n\n private renderEditor() {\n if (this.readonly) {\n return (\n <limel-markdown\n slot=\"content\"\n value={this.value}\n aria-controls={this.helperTextId}\n id={this.editorId}\n />\n );\n }\n\n return (\n <limel-prosemirror-adapter\n slot=\"content\"\n aria-placeholder={this.placeholder}\n contentType={this.contentType}\n onChange={this.handleChange}\n onImagePasted={this.handleImagePasted}\n onImageRemoved={this.handleImageRemoved}\n onMetadataChange={this.handleMetadataChange}\n customElements={this.customElements}\n value={this.value}\n aria-controls={this.helperTextId}\n id={this.editorId}\n aria-disabled={this.disabled}\n aria-invalid={this.invalid}\n aria-required={this.required}\n language={this.language}\n triggerCharacters={this.triggers}\n disabled={this.disabled}\n ui={this.ui}\n />\n );\n }\n\n private renderPlaceholder() {\n if (!this.placeholder || this.value) {\n return;\n }\n\n return (\n <span class=\"placeholder\" aria-hidden=\"true\" slot=\"content\">\n {this.placeholder}\n </span>\n );\n }\n\n private renderHelperLine = () => {\n if (!this.helperText) {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={this.helperText}\n helperTextId={this.helperTextId}\n invalid={this.isInvalid()}\n />\n );\n };\n\n private isInvalid = () => {\n if (this.readonly) {\n // A readonly field can never be invalid.\n return false;\n }\n\n if (this.invalid) {\n return true;\n }\n };\n\n private handleChange = (event: CustomEvent<string>) => {\n event.stopPropagation();\n this.change.emit(event.detail);\n };\n\n private handleImagePasted = (event: CustomEvent<ImageInserter>) => {\n event.stopPropagation();\n this.imagePasted.emit(event.detail);\n };\n\n private handleMetadataChange = (event: CustomEvent<EditorMetadata>) => {\n event.stopPropagation();\n this.metadataChange.emit(event.detail);\n };\n\n private handleImageRemoved = (event: CustomEvent<EditorImage>) => {\n event.stopPropagation();\n // eslint-disable-next-line sonarjs/deprecation\n this.imageRemoved.emit(event.detail);\n };\n}\n"],"mappings":"6FAAA,MAAMA,EAAgB,0mK,MC2CTC,EAAU,MAiMnBC,YAAAC,G,6SA0EQC,KAAAC,iBAAmB,KACvB,IAAKD,KAAKE,WAAY,CAClB,M,CAGJ,OACIC,EAAA,qBACID,WAAYF,KAAKE,WACjBE,aAAcJ,KAAKI,aACnBC,QAASL,KAAKM,aAChB,EAIFN,KAAAM,UAAY,KAChB,GAAIN,KAAKO,SAAU,CAEf,OAAO,K,CAGX,GAAIP,KAAKK,QAAS,CACd,OAAO,I,GAIPL,KAAAQ,aAAgBC,IACpBA,EAAMC,kBACNV,KAAKW,OAAOC,KAAKH,EAAMI,OAAO,EAG1Bb,KAAAc,kBAAqBL,IACzBA,EAAMC,kBACNV,KAAKe,YAAYH,KAAKH,EAAMI,OAAO,EAG/Bb,KAAAgB,qBAAwBP,IAC5BA,EAAMC,kBACNV,KAAKiB,eAAeL,KAAKH,EAAMI,OAAO,EAGlCb,KAAAkB,mBAAsBT,IAC1BA,EAAMC,kBAENV,KAAKmB,aAAaP,KAAKH,EAAMI,OAAO,E,iBAhTE,W,cAMb,K,cASD,M,cAYA,M,uFA0BD,M,yCAkBwB,G,cAYb,G,cAYV,M,iBAOE,K,QAgBH,WAsEvBb,KAAKI,aAAegB,IACpBpB,KAAKqB,SAAWD,G,CAGbE,SACH,OACInB,EAACoB,EAAI,KACDpB,EAAA,yBACIqB,QAASxB,KAAKqB,SACdI,MAAOzB,KAAKyB,MACZC,SAAU1B,KAAK0B,SACfrB,QAASL,KAAKK,QACdsB,SAAU3B,KAAK2B,SACfpB,SAAUP,KAAKO,SACfqB,WAAY5B,KAAK6B,MACjBC,iBAAkB,MAEjB9B,KAAK+B,eACL/B,KAAKgC,qBAEThC,KAAKC,mB,CAKV8B,eACJ,GAAI/B,KAAKO,SAAU,CACf,OACIJ,EAAA,kBACI8B,KAAK,UACLJ,MAAO7B,KAAK6B,MAAK,gBACF7B,KAAKI,aACpB8B,GAAIlC,KAAKqB,U,CAKrB,OACIlB,EAAA,6BACI8B,KAAK,UAAS,mBACIjC,KAAKmC,YACvBC,YAAapC,KAAKoC,YAClBC,SAAUrC,KAAKQ,aACf8B,cAAetC,KAAKc,kBACpByB,eAAgBvC,KAAKkB,mBACrBsB,iBAAkBxC,KAAKgB,qBACvByB,eAAgBzC,KAAKyC,eACrBZ,MAAO7B,KAAK6B,MAAK,gBACF7B,KAAKI,aACpB8B,GAAIlC,KAAKqB,SAAQ,gBACFrB,KAAK2B,SAAQ,eACd3B,KAAKK,QAAO,gBACXL,KAAK0B,SACpBgB,SAAU1C,KAAK0C,SACfC,kBAAmB3C,KAAK4C,SACxBjB,SAAU3B,KAAK2B,SACfkB,GAAI7C,KAAK6C,I,CAKbb,oBACJ,IAAKhC,KAAKmC,aAAenC,KAAK6B,MAAO,CACjC,M,CAGJ,OACI1B,EAAA,QAAM2C,MAAM,cAAa,cAAa,OAAOb,KAAK,WAC7CjC,KAAKmC,Y"}
@@ -1,5 +1,5 @@
1
- import { ActionBarItem } from 'src/components/action-bar/action-bar.types';
2
- import { ListSeparator } from 'src/components/list/list-item.types';
1
+ import { ActionBarItem } from '../../../action-bar/action-bar.types';
2
+ import { ListSeparator } from '../../../list/list-item.types';
3
3
  export declare const getTextEditorMenuItems: () => (ListSeparator | ActionBarItem<string>)[];
4
4
  export declare const menuTranslationIDs: {
5
5
  strong: string;
@@ -1,15 +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, ImageInfo } from '../../../text-editor.types';
5
- import { Node } from 'prosemirror-model';
4
+ import { ImageInserter } from '../../../text-editor.types';
6
5
  export declare const pluginKey: PluginKey<any>;
7
6
  type ImagePastedCallback = (data: ImageInserter) => CustomEvent<ImageInserter>;
8
- type ImageRemovedCallback = (data: ImageInfo) => CustomEvent<ImageInfo>;
9
- type PluginState = {
10
- insertedImages: Record<string, Node>;
11
- };
12
- export declare const createImageInserterPlugin: (imagePastedCallback: ImagePastedCallback, imageRemovedCallback: ImageRemovedCallback) => Plugin<PluginState>;
7
+ export declare const createImageInserterPlugin: (imagePastedCallback: ImagePastedCallback) => Plugin<any>;
13
8
  export declare const imageInserterFactory: (view: EditorView, base64Data: string, fileInfo: FileInfo) => ImageInserter;
14
9
  export {};
15
10
  //# sourceMappingURL=inserter.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { NodeSpec, Node } from 'prosemirror-model';
2
+ import { EditorImageState } from '../../../text-editor.types';
2
3
  import { MarkdownSerializerState } from 'prosemirror-markdown';
3
4
  import { Languages } from '../../../../date-picker/date.types';
4
5
  export declare const imageCache: Map<string, HTMLImageElement>;
@@ -10,5 +11,13 @@ export declare function getImageNodeMarkdownSerializer(language: Languages): Rec
10
11
  * any of its child nodes is an image node.
11
12
  */
12
13
  export declare function hasImageNode(node: Node): boolean;
14
+ export interface ImageNodeAttrs {
15
+ src: string;
16
+ alt: string;
17
+ state: EditorImageState;
18
+ fileInfoId: string | number;
19
+ width?: string;
20
+ maxWidth?: string;
21
+ }
13
22
  export {};
14
23
  //# sourceMappingURL=node.d.ts.map
@@ -1,9 +1,5 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  export declare const linkPluginKey: PluginKey<any>;
3
3
  export type UpdateLinkCallback = (text: string, href: string) => void;
4
- export interface EditorLinkMenuEventDetail {
5
- href: string;
6
- text: string;
7
- }
8
4
  export declare const createLinkPlugin: (updateLinkCallback?: UpdateLinkCallback) => Plugin<any>;
9
5
  //# sourceMappingURL=link-plugin.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { EditorState, Transaction } from 'prosemirror-state';
2
2
  import { EditorView } from 'prosemirror-view';
3
3
  import { ContentTypeConverter } from '../../../../utils/content-type-converter';
4
- import { Trigger } from 'src/components/text-editor/text-editor.types';
4
+ import { Trigger } from '../../../../../text-editor/text-editor.types';
5
5
  export declare const getAppendTransactionHandler: (getCurrentView: () => EditorView | null, getActiveTrigger: () => Trigger | null, resetActiveTrigger: () => void, contentConverter: ContentTypeConverter) => (transactions: Transaction[], _oldState: EditorState, newState: EditorState) => Transaction;
6
6
  //# sourceMappingURL=append-transaction-handler.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Transaction } from 'prosemirror-state';
2
2
  import { EditorView } from 'prosemirror-view';
3
3
  import { ContentTypeConverter } from '../../../../utils/content-type-converter';
4
- import { Trigger } from 'src/components/text-editor/text-editor.types';
4
+ import { Trigger } from '../../../../../text-editor/text-editor.types';
5
5
  export declare const detectTriggerRemoval: (transaction: Transaction, activeTrigger: Trigger | null, resetActiveTrigger: () => void, contentConverter: ContentTypeConverter, view: EditorView) => boolean;
6
6
  //# sourceMappingURL=detect-trigger-removal.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
- import { Trigger, TriggerEventDetail } from 'src/components/text-editor/text-editor.types';
3
- import { ContentTypeConverter } from 'src/components/text-editor/utils/content-type-converter';
2
+ import { Trigger, TriggerEventDetail } from '../../../../../text-editor/text-editor.types';
3
+ import { ContentTypeConverter } from '../../../../../text-editor/utils/content-type-converter';
4
4
  export declare const getTriggerEventDetail: (view: EditorView, contentConverter: ContentTypeConverter, trigger: Trigger, value: string) => TriggerEventDetail;
5
5
  //# sourceMappingURL=get-trigger-event-detail.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
- import { Trigger } from 'src/components/text-editor/text-editor.types';
3
- import { ContentTypeConverter } from 'src/components/text-editor/utils/content-type-converter';
2
+ import { Trigger } from '../../../../../text-editor/text-editor.types';
3
+ import { ContentTypeConverter } from '../../../../../text-editor/utils/content-type-converter';
4
4
  export declare const monitorTriggeredText: (doc: any, activeTrigger: Trigger, cursorPosition: number, contentConverter: ContentTypeConverter, view: EditorView) => string;
5
5
  //# sourceMappingURL=monitor-triggered-text.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
- import { Trigger } from 'src/components/text-editor/text-editor.types';
2
+ import { Trigger } from '../../../../../text-editor/text-editor.types';
3
3
  import { ContentTypeConverter } from '../../../../utils/content-type-converter';
4
4
  export declare const sendTriggerEvent: (type: 'triggerStart' | 'triggerStop' | 'triggerChange', view: EditorView, contentConverter: ContentTypeConverter, trigger: Trigger, value: string) => void;
5
5
  //# sourceMappingURL=send-trigger-event.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
- import { Trigger, TriggerCharacter } from 'src/components/text-editor/text-editor.types';
2
+ import { Trigger, TriggerCharacter } from '../../../../../text-editor/text-editor.types';
3
3
  import { ContentTypeConverter } from '../../../../utils/content-type-converter';
4
4
  export declare const getTextInputHandler: (contentConverter: ContentTypeConverter, triggerCharacters: TriggerCharacter[], updateActiveTrigger: (trigger: Trigger | null) => void) => (view: EditorView, _from: number, _to: number, text: string) => boolean;
5
5
  //# sourceMappingURL=text-input-handler.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
- import { TriggerCharacter } from 'src/components/text-editor/text-editor.types';
2
+ import { TriggerCharacter } from '../../../../text-editor/text-editor.types';
3
3
  import { ContentTypeConverter } from '../../../utils/content-type-converter';
4
4
  export declare const createTriggerPlugin: (triggerCharacters: TriggerCharacter[], contentConverter: ContentTypeConverter) => Plugin<{}>;
5
5
  //# sourceMappingURL=factory.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
- import { TextEditor, Trigger } from 'src/components/text-editor/text-editor.types';
2
+ import { TextEditor, Trigger } from '../../../../text-editor/text-editor.types';
3
3
  import { ContentTypeConverter } from '../../../utils/content-type-converter';
4
4
  export declare const inserterFactory: (view: EditorView, contentConverter: ContentTypeConverter, trigger: Trigger) => TextEditor;
5
5
  //# sourceMappingURL=inserter.d.ts.map
@@ -66,6 +66,7 @@ export declare class ProsemirrorAdapter {
66
66
  private actionBarElement;
67
67
  private lastEmittedValue;
68
68
  private changeWaiting;
69
+ private metadata;
69
70
  /**
70
71
  * Used to stop change event emitting as result of getting updated value from consumer
71
72
  */
@@ -88,6 +89,13 @@ export declare class ProsemirrorAdapter {
88
89
  * @alpha
89
90
  */
90
91
  private imageRemoved;
92
+ /**
93
+ * Dispatched when the metadata of the editor changes (images and links)
94
+ *
95
+ * @private
96
+ * @alpha
97
+ */
98
+ private metadataChange;
91
99
  constructor();
92
100
  protected watchValue(newValue: string): void;
93
101
  componentWillLoad(): void;
@@ -107,6 +115,8 @@ export declare class ProsemirrorAdapter {
107
115
  private updateActiveActionBarItems;
108
116
  private updateView;
109
117
  private handleTransaction;
118
+ private metadataEmitter;
119
+ private removeImagesFromCache;
110
120
  private handleActionBarItem;
111
121
  private handleCancelLinkMenu;
112
122
  private handleSaveLinkMenu;
@@ -142,8 +142,17 @@ export declare class TextEditor implements FormComponent<string> {
142
142
  *
143
143
  * @private
144
144
  * @alpha
145
+ * @deprecated - This event is deprecated and will be removed in a future version.
146
+ * Use the `metadataChange` event instead to track image removals.
145
147
  */
146
148
  private readonly imageRemoved;
149
+ /**
150
+ * Dispatched when the metadata of the editor changes
151
+ *
152
+ * @private
153
+ * @alpha
154
+ */
155
+ private readonly metadataChange;
147
156
  /**
148
157
  * Dispatched if a trigger character is detected.
149
158
  *
@@ -177,6 +186,7 @@ export declare class TextEditor implements FormComponent<string> {
177
186
  private isInvalid;
178
187
  private handleChange;
179
188
  private handleImagePasted;
189
+ private handleMetadataChange;
180
190
  private handleImageRemoved;
181
191
  }
182
192
  //# sourceMappingURL=text-editor.d.ts.map
@@ -55,15 +55,11 @@ export interface ImageInserter {
55
55
  /**
56
56
  * @alpha
57
57
  */
58
- export declare enum ImageState {
59
- LOADING = "loading",
60
- FAILED = "failed",
61
- SUCCESS = "success"
62
- }
58
+ export type EditorImageState = 'loading' | 'failed' | 'success';
63
59
  /**
64
60
  * @alpha
65
61
  */
66
- export interface ImageInfo {
62
+ export interface EditorImage {
67
63
  /**
68
64
  * Unique ID of the image file.
69
65
  */
@@ -76,7 +72,20 @@ export interface ImageInfo {
76
72
  /**
77
73
  * The current state of the image.
78
74
  */
79
- state: ImageState;
75
+ state: EditorImageState;
76
+ }
77
+ /**
78
+ * @alpha
79
+ */
80
+ export interface EditorLink {
81
+ /**
82
+ * The URL of the link.
83
+ */
84
+ href: string;
85
+ /**
86
+ * The text associated with the link.
87
+ */
88
+ text: string;
80
89
  }
81
90
  /**
82
91
  * @alpha
@@ -110,4 +119,20 @@ export interface TriggerEventDetail {
110
119
  */
111
120
  value: string;
112
121
  }
122
+ /**
123
+ *
124
+ * @alpha
125
+ *
126
+ * Interface representing metadata extracted from the editor document
127
+ */
128
+ export interface EditorMetadata {
129
+ /**
130
+ * Collection of image elements found in the document
131
+ */
132
+ images: EditorImage[];
133
+ /**
134
+ * Collection of link elements found in the document
135
+ */
136
+ links: EditorLink[];
137
+ }
113
138
  //# sourceMappingURL=text-editor.types.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { EditorMetadata } from '../text-editor.types';
2
+ import { Node } from 'prosemirror-model';
3
+ /**
4
+ * Extracts metadata from a ProseMirror document node
5
+ *
6
+ * This function traverses the entire document tree and collects information about
7
+ * special elements like images and links.
8
+ *
9
+ * @param doc - The ProseMirror document node to extract metadata from
10
+ * @returns A metadata object containing arrays of images and links found in the document
11
+ */
12
+ export declare function getMetadataFromDoc(doc: Node): EditorMetadata;
13
+ /**
14
+ * Determines if metadata has changed between two states
15
+ * Handles duplicates correctly but is order-insensitive
16
+ *
17
+ * @param oldMetadata - The previous metadata state to compare against
18
+ * @param newMetadata - The current metadata state
19
+ * @returns True if there are any differences between the metadata objects, false otherwise
20
+ */
21
+ export declare function hasMetadataChanged(oldMetadata: EditorMetadata, newMetadata: EditorMetadata): boolean;
22
+ //# sourceMappingURL=metadata-utils.d.ts.map
@@ -39,7 +39,7 @@ import { PickerValue } from "./components/picker/value.types";
39
39
  import { Searcher } from "./components/picker/searcher.types";
40
40
  import { ActionPosition, ActionScrollBehavior } from "./components/picker/actions.types";
41
41
  import { FlowItem } from "./components/progress-flow/progress-flow.types";
42
- import { ImageInfo, ImageInserter, TriggerCharacter, TriggerEventDetail } from "./components/text-editor/text-editor.types";
42
+ import { EditorImage, EditorMetadata, ImageInserter, TriggerCharacter, TriggerEventDetail } from "./components/text-editor/text-editor.types";
43
43
  import { EditorUiType } from "./components/text-editor/types";
44
44
  import { Option } from "./components/select/option.types";
45
45
  import { SpinnerSize } from "./components/spinner/spinner.types";
@@ -81,7 +81,7 @@ export { PickerValue } from "./components/picker/value.types";
81
81
  export { Searcher } from "./components/picker/searcher.types";
82
82
  export { ActionPosition, ActionScrollBehavior } from "./components/picker/actions.types";
83
83
  export { FlowItem } from "./components/progress-flow/progress-flow.types";
84
- export { ImageInfo, ImageInserter, TriggerCharacter, TriggerEventDetail } from "./components/text-editor/text-editor.types";
84
+ export { EditorImage, EditorMetadata, ImageInserter, TriggerCharacter, TriggerEventDetail } from "./components/text-editor/text-editor.types";
85
85
  export { EditorUiType } from "./components/text-editor/types";
86
86
  export { Option } from "./components/select/option.types";
87
87
  export { SpinnerSize } from "./components/spinner/spinner.types";
@@ -7234,7 +7234,13 @@ declare namespace LocalJSX {
7234
7234
  * @private
7235
7235
  * @alpha
7236
7236
  */
7237
- "onImageRemoved"?: (event: LimelProsemirrorAdapterCustomEvent<ImageInfo>) => void;
7237
+ "onImageRemoved"?: (event: LimelProsemirrorAdapterCustomEvent<EditorImage>) => void;
7238
+ /**
7239
+ * Dispatched when the metadata of the editor changes (images and links)
7240
+ * @private
7241
+ * @alpha
7242
+ */
7243
+ "onMetadataChange"?: (event: LimelProsemirrorAdapterCustomEvent<EditorMetadata>) => void;
7238
7244
  /**
7239
7245
  * set to private to avoid usage while under development
7240
7246
  * @private
@@ -7796,9 +7802,16 @@ declare namespace LocalJSX {
7796
7802
  /**
7797
7803
  * Dispatched when a image is removed from the editor
7798
7804
  * @private
7805
+ * @alpha
7806
+ * @deprecated - This event is deprecated and will be removed in a future version. Use the `metadataChange` event instead to track image removals.
7807
+ */
7808
+ "onImageRemoved"?: (event: LimelTextEditorCustomEvent<EditorImage>) => void;
7809
+ /**
7810
+ * Dispatched when the metadata of the editor changes
7811
+ * @private
7799
7812
  * @alpha
7800
7813
  */
7801
- "onImageRemoved"?: (event: LimelTextEditorCustomEvent<ImageInfo>) => void;
7814
+ "onMetadataChange"?: (event: LimelTextEditorCustomEvent<EditorMetadata>) => void;
7802
7815
  /**
7803
7816
  * Dispatched if a input is changed during an active trigger.
7804
7817
  * @private
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "38.11.0",
3
+ "version": "38.12.0",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * @alpha
5
- */
6
- exports.ImageState = void 0;
7
- (function (ImageState) {
8
- ImageState["LOADING"] = "loading";
9
- ImageState["FAILED"] = "failed";
10
- ImageState["SUCCESS"] = "success";
11
- })(exports.ImageState || (exports.ImageState = {}));
12
-
13
- //# sourceMappingURL=text-editor.types-5e5567e2.js.map
@@ -1 +0,0 @@
1
- {"file":"text-editor.types-5e5567e2.js","mappings":";;AA6FA;;;AAGYA;AAAZ,WAAY,UAAU;EAClB,iCAAmB,CAAA;EACnB,+BAAiB,CAAA;EACjB,iCAAmB,CAAA;AACvB,CAAC,EAJWA,kBAAU,KAAVA,kBAAU;;","names":["ImageState"],"sources":["./src/components/text-editor/text-editor.types.ts"],"sourcesContent":["import { CustomElement } from '../../global/shared-types/custom-element.types';\nimport { FileInfo } from '../../global/shared-types/file.types';\n\n/**\n * Represents a trigger character and its position in the text.\n *\n * @alpha\n */\nexport type Trigger = {\n character: TriggerCharacter;\n position: number;\n};\n\n/**\n * A character that triggers a specific action in the text editor.\n *\n * @alpha\n */\nexport type TriggerCharacter =\n | '@'\n | '#'\n | '$'\n | '!'\n | '?'\n | '&'\n | '*'\n | '%'\n | '+'\n | '-'\n | '='\n | '/'\n | '\\\\'\n | '^'\n | '~'\n | '`'\n | ':'\n | ';'\n | '|'\n | '.'\n | ','\n | '<'\n | '>'\n | '['\n | ']'\n | '{'\n | '}'\n | '('\n | ')'\n | \"'\";\n\n/**\n * @alpha\n */\nexport type TextEditorNode = {\n /**\n * The top node\n */\n node: CustomElement | string;\n\n /**\n * One more more children under the top node\n */\n children?: Array<TextEditorNode | string>;\n};\n\n/**\n * @alpha\n */\nexport interface ImageInserter {\n fileInfo: FileInfo;\n\n /**\n * Method to insert a thumbnail at the cursor position.\n */\n insertThumbnail: () => void;\n\n /**\n * Method to insert the image at the thumbnail position.\n * Thumbnail must be inserted before calling this method.\n *\n * @param src - The src url of the uploaded image.\n * If not provided, the image will be inserted with base64 data.\n *\n */\n insertImage: (src?: string) => void;\n\n /**\n * Method to insert a failed thumbnail at the thumbnail position.\n * Thumbnail must be inserted before calling this method.\n */\n insertFailedThumbnail: () => void;\n}\n\n/**\n * @alpha\n */\nexport enum ImageState {\n LOADING = 'loading',\n FAILED = 'failed',\n SUCCESS = 'success',\n}\n\n/**\n * @alpha\n */\nexport interface ImageInfo {\n /**\n * Unique ID of the image file.\n */\n fileInfoId: string;\n /**\n * The source of the image.\n * Can either be a URL pointing to the image or a base64 encoded string.\n */\n src: string;\n /**\n * The current state of the image.\n */\n state: ImageState;\n}\n\n/**\n * @alpha\n */\nexport interface TextEditor {\n /**\n * Method to insert either text or a node at the cursor position\n */\n insert: (input: TextEditorNode | string) => void;\n\n /**\n * Method to insert an HTML string at the cursor position\n */\n insertHtml: (input: string) => Promise<void>;\n\n stopTrigger: () => void;\n}\n\n/**\n * @alpha\n */\nexport interface TriggerEventDetail {\n /**\n * The trigger that triggered this event\n *\n */\n trigger: TriggerCharacter;\n\n /**\n * The text editor\n */\n textEditor: TextEditor;\n\n /**\n * Current value of the trigger\n */\n value: string;\n}\n"],"version":3}
@@ -1,13 +0,0 @@
1
- /**
2
- * @alpha
3
- */
4
- var ImageState;
5
- (function (ImageState) {
6
- ImageState["LOADING"] = "loading";
7
- ImageState["FAILED"] = "failed";
8
- ImageState["SUCCESS"] = "success";
9
- })(ImageState || (ImageState = {}));
10
-
11
- export { ImageState as I };
12
-
13
- //# sourceMappingURL=text-editor.types-e82469d1.js.map
@@ -1 +0,0 @@
1
- {"file":"text-editor.types-e82469d1.js","mappings":"AA6FA;;;IAGY;AAAZ,WAAY,UAAU;EAClB,iCAAmB,CAAA;EACnB,+BAAiB,CAAA;EACjB,iCAAmB,CAAA;AACvB,CAAC,EAJW,UAAU,KAAV,UAAU;;;;","names":[],"sources":["./src/components/text-editor/text-editor.types.ts"],"sourcesContent":["import { CustomElement } from '../../global/shared-types/custom-element.types';\nimport { FileInfo } from '../../global/shared-types/file.types';\n\n/**\n * Represents a trigger character and its position in the text.\n *\n * @alpha\n */\nexport type Trigger = {\n character: TriggerCharacter;\n position: number;\n};\n\n/**\n * A character that triggers a specific action in the text editor.\n *\n * @alpha\n */\nexport type TriggerCharacter =\n | '@'\n | '#'\n | '$'\n | '!'\n | '?'\n | '&'\n | '*'\n | '%'\n | '+'\n | '-'\n | '='\n | '/'\n | '\\\\'\n | '^'\n | '~'\n | '`'\n | ':'\n | ';'\n | '|'\n | '.'\n | ','\n | '<'\n | '>'\n | '['\n | ']'\n | '{'\n | '}'\n | '('\n | ')'\n | \"'\";\n\n/**\n * @alpha\n */\nexport type TextEditorNode = {\n /**\n * The top node\n */\n node: CustomElement | string;\n\n /**\n * One more more children under the top node\n */\n children?: Array<TextEditorNode | string>;\n};\n\n/**\n * @alpha\n */\nexport interface ImageInserter {\n fileInfo: FileInfo;\n\n /**\n * Method to insert a thumbnail at the cursor position.\n */\n insertThumbnail: () => void;\n\n /**\n * Method to insert the image at the thumbnail position.\n * Thumbnail must be inserted before calling this method.\n *\n * @param src - The src url of the uploaded image.\n * If not provided, the image will be inserted with base64 data.\n *\n */\n insertImage: (src?: string) => void;\n\n /**\n * Method to insert a failed thumbnail at the thumbnail position.\n * Thumbnail must be inserted before calling this method.\n */\n insertFailedThumbnail: () => void;\n}\n\n/**\n * @alpha\n */\nexport enum ImageState {\n LOADING = 'loading',\n FAILED = 'failed',\n SUCCESS = 'success',\n}\n\n/**\n * @alpha\n */\nexport interface ImageInfo {\n /**\n * Unique ID of the image file.\n */\n fileInfoId: string;\n /**\n * The source of the image.\n * Can either be a URL pointing to the image or a base64 encoded string.\n */\n src: string;\n /**\n * The current state of the image.\n */\n state: ImageState;\n}\n\n/**\n * @alpha\n */\nexport interface TextEditor {\n /**\n * Method to insert either text or a node at the cursor position\n */\n insert: (input: TextEditorNode | string) => void;\n\n /**\n * Method to insert an HTML string at the cursor position\n */\n insertHtml: (input: string) => Promise<void>;\n\n stopTrigger: () => void;\n}\n\n/**\n * @alpha\n */\nexport interface TriggerEventDetail {\n /**\n * The trigger that triggered this event\n *\n */\n trigger: TriggerCharacter;\n\n /**\n * The text editor\n */\n textEditor: TextEditor;\n\n /**\n * Current value of the trigger\n */\n value: string;\n}\n"],"version":3}
@@ -1 +0,0 @@
1
- {"version":3,"names":["textEditorCss","TextEditor","constructor","hostRef","this","renderHelperLine","helperText","h","helperTextId","invalid","isInvalid","readonly","handleChange","event","stopPropagation","change","emit","detail","handleImagePasted","imagePasted","handleImageRemoved","imageRemoved","createRandomString","editorId","render","Host","labelId","label","required","disabled","hasValue","value","hasFloatingLabel","renderEditor","renderPlaceholder","slot","id","placeholder","contentType","onChange","onImagePasted","onImageRemoved","customElements","language","triggerCharacters","triggers","ui","class"],"sources":["./src/components/text-editor/text-editor.scss?tag=limel-text-editor&encapsulation=shadow","./src/components/text-editor/text-editor.tsx"],"sourcesContent":["@use '../../style/internal/shared_input-select-picker';\n@use '../../style/mixins.scss';\n\n/**\n * @prop --text-editor-max-height: the tallest height the text editor can become when auto-resizing itself. Defaults to `calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem)`.\n * @prop --text-editor-fade-out-background-color: the color of the fade-out effect at the top and bottom of the text editor, when the text-editor is in readonly state. Defaults to rgb(var(--contrast-100)).\n */\n\n* {\n box-sizing: border-box;\n}\n\n$min-height: 5rem;\n$min-height-condensed: calc($min-height / 2);\n\n:host(limel-text-editor) {\n --limel-notched-outline-z-index: 2; // since `div.toolbar` has `z-index: 1;`\n --limel-prosemirror-adapter-toolbar-opacity: 0.6;\n --limel-text-editor-padding: 0.25rem 1rem 0.75rem 1rem;\n --limel-prosemirror-adapter-toolbar-grid-template-rows: 1fr;\n --limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration: 0.3s;\n --limel-prosemirror-adapter-toolbar-transition-timing-function: cubic-bezier(\n 0.19,\n 0.23,\n 0.26,\n 0.89\n );\n\n position: relative;\n isolation: isolate;\n display: flex;\n flex-direction: column;\n\n width: 100%;\n min-width: 5rem;\n min-height: $min-height;\n height: 100%;\n max-height: var(\n --text-editor-max-height,\n calc(\n 100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) -\n 4rem\n )\n );\n padding: 1px; // prevents visual defects that can appear due to the backdrop-filter and closeness to borders\n}\n\n:host(limel-text-editor:focus-within),\n:host(limel-text-editor:not([ui='minimal']):hover) {\n --limel-prosemirror-adapter-toolbar-opacity: 1;\n}\n\n:host(limel-text-editor[ui='minimal']:not(:focus-within)) {\n --limel-prosemirror-adapter-toolbar-grid-template-rows: 0fr;\n --limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration: 0.46s;\n --limel-prosemirror-adapter-action-bar-padding-top-bottom: 0;\n --limel-prosemirror-adapter-toolbar-opacity: 0;\n}\n\n:host(limel-text-editor[ui='minimal']:not(:focus-within)),\n:host(limel-text-editor[ui='no-toolbar']) {\n --limel-text-editor-padding: 0.75rem 1rem 0.75rem 1rem;\n --limel-text-editor-placeholder-top: 0;\n\n min-height: $min-height-condensed;\n limel-prosemirror-adapter {\n min-height: $min-height-condensed;\n }\n}\n\n:host(limel-text-editor:focus-within),\n:host(limel-text-editor:focus) {\n .placeholder {\n opacity: 0;\n }\n}\n\n:host(limel-text-editor[disabled]:not([disabled='false'])) {\n limel-prosemirror-adapter {\n @include shared_input-select-picker.looks-disabled;\n pointer-events: none;\n }\n}\n\n:host(limel-text-editor[readonly]:not([readonly='false'])) {\n --limel-text-editor-padding: 0.75rem 1rem 0.75rem 1rem;\n --limel-text-editor-placeholder-top: 0;\n\n limel-markdown {\n // displayed when `readonly` instead of the adapter\n display: block;\n padding: var(--limel-text-editor-padding);\n\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n height: 100%;\n\n &:before,\n &:after {\n z-index: 1;\n pointer-events: none;\n content: '';\n display: block;\n position: absolute;\n width: 100%;\n }\n &:after {\n height: 1.75rem;\n top: 0;\n background: linear-gradient(\n var(\n --text-editor-fade-out-background-color,\n rgb(var(--contrast-100))\n ),\n transparent\n );\n }\n\n &:before {\n height: 2rem;\n bottom: -0.25rem;\n background: linear-gradient(\n transparent,\n var(\n --text-editor-fade-out-background-color,\n rgb(var(--contrast-100))\n )\n );\n }\n }\n}\n\n.placeholder {\n transition-property: top;\n transition-duration: var(\n --limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration\n );\n transition-timing-function: var(\n --limel-prosemirror-adapter-toolbar-transition-timing-function\n );\n @include mixins.truncate-text;\n pointer-events: none;\n position: absolute;\n top: var(--limel-text-editor-placeholder-top, 2.25rem);\n left: 0;\n right: 0;\n\n padding: var(--limel-text-editor-padding);\n font-style: italic;\n font-size: 0.875rem;\n color: shared_input-select-picker.$input-placeholder-color;\n}\n\nlimel-prosemirror-adapter {\n flex-grow: 1;\n\n min-width: 0;\n min-height: $min-height;\n height: 100%;\n overflow: hidden auto;\n -webkit-overflow-scrolling: touch;\n}\n\n@include mixins.hide-helper-line-when-not-needed(limel-text-editor);\n\n:host(limel-text-editor[allow-resize]) {\n limel-prosemirror-adapter {\n resize: vertical;\n }\n}\n","import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport { FormComponent } from '../form/form.types';\nimport { Languages } from '../date-picker/date.types';\nimport { createRandomString } from '../../util/random-string';\nimport { CustomElementDefinition } from '../../global/shared-types/custom-element.types';\nimport {\n TriggerCharacter,\n TriggerEventDetail,\n ImageInserter,\n ImageInfo,\n} from './text-editor.types';\nimport { EditorUiType } from './types';\n\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-with-markdown\n * @exampleComponent limel-example-text-editor-with-html\n * @exampleComponent limel-example-text-editor-with-tables\n * @exampleComponent limel-example-text-editor-with-inline-images-file-storage\n * @exampleComponent limel-example-text-editor-with-inline-images-base64\n * @exampleComponent limel-example-text-editor-allow-resize\n * @exampleComponent limel-example-text-editor-size\n * @exampleComponent limel-example-text-editor-ui\n * @exampleComponent limel-example-text-editor-custom-element\n * @exampleComponent limel-example-text-editor-triggers\n * @exampleComponent limel-example-text-editor-composite\n * @beta\n */\n@Component({\n tag: 'limel-text-editor',\n shadow: { delegatesFocus: true },\n styleUrl: 'text-editor.scss',\n})\nexport class TextEditor implements FormComponent<string> {\n /** The type of content that the editor should handle and emit, defaults to `markdown`\n *\n * Assumed to be set only once, so not reactive to changes\n */\n @Prop()\n public contentType: 'markdown' | 'html' = 'markdown';\n\n /**\n * Defines the language for translations.\n */\n @Prop({ reflect: true })\n public language: Languages = 'en';\n\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 = false;\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 = false;\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 = false;\n\n /**\n * Description of the text inside the editor as markdown\n */\n @Prop({ reflect: true })\n public value: string;\n\n /**\n * A list of custom elements\n *\n * Any `CustomElement` that should be used inside the text editor needs\n * to be defined here.\n *\n * @private\n * @alpha\n */\n @Prop()\n public customElements: CustomElementDefinition[] = [];\n\n /**\n * A set of trigger characters\n *\n * Defining a character here will enable trigger events to be sent if the\n * character is detected in the editor.\n *\n * @private\n * @alpha\n */\n @Prop()\n public triggers: TriggerCharacter[] = [];\n\n /**\n * Set to `true` to indicate that the field is required.\n *\n * :::important\n * An empty but required field is not automatically considered invalid.\n * You must make sure to check the validity of the field on your own,\n * and properly handle the `invalid` state.\n * :::\n */\n @Prop({ reflect: true })\n public required?: boolean = false;\n\n /**\n * Set to `true` to allow the user to vertically resize the editor.\n * Set to `false` to disable the resize functionality.\n */\n @Prop({ reflect: true })\n public allowResize: boolean = true;\n\n /**\n * Specifies the visual appearance of the editor.\n *\n * - `standard`: The default editor appearance with a full toolbar and\n * standard layout.\n * - `minimal`: A compact editor appearance, ideal for limited space\n * scenarios such as mobile devices. In this mode, the toolbar is hidden\n * until the editor is focused.\n * - `no-toolbar`: A basic textarea appearance without any text styling toolbar.\n * This mode is suitable for scenarios where you want to provide a simple\n * text input without any visible formatting options; but still provide\n * support for markdown syntax and rich text, using hotkeys or when pasting.\n */\n @Prop({ reflect: true })\n public ui?: EditorUiType = 'standard';\n\n /**\n * Dispatched when a change is made to the editor\n */\n @Event()\n public change: EventEmitter<string>;\n\n /**\n * Dispatched when a image is pasted into the editor\n *\n * @private\n * @alpha\n */\n @Event()\n private readonly imagePasted: EventEmitter<ImageInserter>;\n\n /**\n * Dispatched when a image is removed from the editor\n *\n * @private\n * @alpha\n */\n @Event()\n private readonly imageRemoved: EventEmitter<ImageInfo>;\n\n /**\n * Dispatched if a trigger character is detected.\n *\n * @private\n * @alpha\n */\n @Event()\n public triggerStart: EventEmitter<TriggerEventDetail>;\n\n /**\n * Dispatched if a trigger session is ended. That is if the selection\n * goes outside the trigger input or if something is inserted using the\n * supplied `TextEditor` insert function.\n *\n * @private\n * @alpha\n */\n @Event()\n public triggerStop: EventEmitter<TriggerEventDetail>;\n\n /**\n * Dispatched if a input is changed during an active trigger.\n *\n * @private\n * @alpha\n */\n @Event()\n public triggerChange: EventEmitter<TriggerEventDetail>;\n\n private readonly helperTextId: string;\n private readonly editorId: string;\n\n public constructor() {\n this.helperTextId = createRandomString();\n this.editorId = createRandomString();\n }\n\n public render() {\n return (\n <Host>\n <limel-notched-outline\n labelId={this.editorId}\n label={this.label}\n required={this.required}\n invalid={this.invalid}\n disabled={this.disabled}\n readonly={this.readonly}\n hasValue={!!this.value}\n hasFloatingLabel={true}\n >\n {this.renderEditor()}\n {this.renderPlaceholder()}\n </limel-notched-outline>\n {this.renderHelperLine()}\n </Host>\n );\n }\n\n private renderEditor() {\n if (this.readonly) {\n return (\n <limel-markdown\n slot=\"content\"\n value={this.value}\n aria-controls={this.helperTextId}\n id={this.editorId}\n />\n );\n }\n\n return (\n <limel-prosemirror-adapter\n slot=\"content\"\n aria-placeholder={this.placeholder}\n contentType={this.contentType}\n onChange={this.handleChange}\n onImagePasted={this.handleImagePasted}\n onImageRemoved={this.handleImageRemoved}\n customElements={this.customElements}\n value={this.value}\n aria-controls={this.helperTextId}\n id={this.editorId}\n aria-disabled={this.disabled}\n aria-invalid={this.invalid}\n aria-required={this.required}\n language={this.language}\n triggerCharacters={this.triggers}\n disabled={this.disabled}\n ui={this.ui}\n />\n );\n }\n\n private renderPlaceholder() {\n if (!this.placeholder || this.value) {\n return;\n }\n\n return (\n <span class=\"placeholder\" aria-hidden=\"true\" slot=\"content\">\n {this.placeholder}\n </span>\n );\n }\n\n private renderHelperLine = () => {\n if (!this.helperText) {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={this.helperText}\n helperTextId={this.helperTextId}\n invalid={this.isInvalid()}\n />\n );\n };\n\n private isInvalid = () => {\n if (this.readonly) {\n // A readonly field can never be invalid.\n return false;\n }\n\n if (this.invalid) {\n return true;\n }\n };\n\n private handleChange = (event: CustomEvent<string>) => {\n event.stopPropagation();\n this.change.emit(event.detail);\n };\n\n private handleImagePasted = (event: CustomEvent<ImageInserter>) => {\n event.stopPropagation();\n this.imagePasted.emit(event.detail);\n };\n\n private handleImageRemoved = (event: CustomEvent<ImageInfo>) => {\n event.stopPropagation();\n this.imageRemoved.emit(event.detail);\n };\n}\n"],"mappings":"6FAAA,MAAMA,EAAgB,0mK,MC0CTC,EAAU,MAsLnBC,YAAAC,G,8PAyEQC,KAAAC,iBAAmB,KACvB,IAAKD,KAAKE,WAAY,CAClB,M,CAGJ,OACIC,EAAA,qBACID,WAAYF,KAAKE,WACjBE,aAAcJ,KAAKI,aACnBC,QAASL,KAAKM,aAChB,EAIFN,KAAAM,UAAY,KAChB,GAAIN,KAAKO,SAAU,CAEf,OAAO,K,CAGX,GAAIP,KAAKK,QAAS,CACd,OAAO,I,GAIPL,KAAAQ,aAAgBC,IACpBA,EAAMC,kBACNV,KAAKW,OAAOC,KAAKH,EAAMI,OAAO,EAG1Bb,KAAAc,kBAAqBL,IACzBA,EAAMC,kBACNV,KAAKe,YAAYH,KAAKH,EAAMI,OAAO,EAG/Bb,KAAAgB,mBAAsBP,IAC1BA,EAAMC,kBACNV,KAAKiB,aAAaL,KAAKH,EAAMI,OAAO,E,iBA9RE,W,cAMb,K,cASD,M,cAYA,M,uFA0BD,M,yCAkBwB,G,cAYb,G,cAYV,M,iBAOE,K,QAgBH,WA2DvBb,KAAKI,aAAec,IACpBlB,KAAKmB,SAAWD,G,CAGbE,SACH,OACIjB,EAACkB,EAAI,KACDlB,EAAA,yBACImB,QAAStB,KAAKmB,SACdI,MAAOvB,KAAKuB,MACZC,SAAUxB,KAAKwB,SACfnB,QAASL,KAAKK,QACdoB,SAAUzB,KAAKyB,SACflB,SAAUP,KAAKO,SACfmB,WAAY1B,KAAK2B,MACjBC,iBAAkB,MAEjB5B,KAAK6B,eACL7B,KAAK8B,qBAET9B,KAAKC,mB,CAKV4B,eACJ,GAAI7B,KAAKO,SAAU,CACf,OACIJ,EAAA,kBACI4B,KAAK,UACLJ,MAAO3B,KAAK2B,MAAK,gBACF3B,KAAKI,aACpB4B,GAAIhC,KAAKmB,U,CAKrB,OACIhB,EAAA,6BACI4B,KAAK,UAAS,mBACI/B,KAAKiC,YACvBC,YAAalC,KAAKkC,YAClBC,SAAUnC,KAAKQ,aACf4B,cAAepC,KAAKc,kBACpBuB,eAAgBrC,KAAKgB,mBACrBsB,eAAgBtC,KAAKsC,eACrBX,MAAO3B,KAAK2B,MAAK,gBACF3B,KAAKI,aACpB4B,GAAIhC,KAAKmB,SAAQ,gBACFnB,KAAKyB,SAAQ,eACdzB,KAAKK,QAAO,gBACXL,KAAKwB,SACpBe,SAAUvC,KAAKuC,SACfC,kBAAmBxC,KAAKyC,SACxBhB,SAAUzB,KAAKyB,SACfiB,GAAI1C,KAAK0C,I,CAKbZ,oBACJ,IAAK9B,KAAKiC,aAAejC,KAAK2B,MAAO,CACjC,M,CAGJ,OACIxB,EAAA,QAAMwC,MAAM,cAAa,cAAa,OAAOZ,KAAK,WAC7C/B,KAAKiC,Y"}