@limetech/lime-elements 37.61.4 → 37.61.5
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 +10 -0
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +33 -6
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js +1 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +31 -7
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/text-editor/text-editor.js.map +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +33 -6
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/limel-text-editor.entry.js +1 -1
- package/dist/esm/limel-text-editor.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-81c918c4.entry.js → p-595fdf97.entry.js} +2 -2
- package/dist/lime-elements/{p-81c918c4.entry.js.map → p-595fdf97.entry.js.map} +1 -1
- package/dist/lime-elements/p-ccc605fe.entry.js +2 -0
- package/dist/lime-elements/p-ccc605fe.entry.js.map +1 -0
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +4 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-df684b38.entry.js +0 -2
- package/dist/lime-elements/p-df684b38.entry.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [37.61.5](https://github.com/Lundalogik/lime-elements/compare/v37.61.4...v37.61.5) (2024-09-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **text-editor:** correct change handler function signature ([62595d6](https://github.com/Lundalogik/lime-elements/commit/62595d6beba6e970de94df33d589f7196ad29cb6))
|
|
8
|
+
* **text-editor:** do not emit change events unless the value has actually changed ([4d0efc5](https://github.com/Lundalogik/lime-elements/commit/4d0efc5d728824c0b1aff53a15482ff4291985b3))
|
|
9
|
+
* **text-editor:** handle change better to keep value in sync ([6649350](https://github.com/Lundalogik/lime-elements/commit/66493508b357a0d3e10676c94d9c19b6a798e722)), closes [Lundalogik/crm-feature#4312](https://github.com/Lundalogik/crm-feature/issues/4312)
|
|
10
|
+
|
|
1
11
|
## [37.61.4](https://github.com/Lundalogik/lime-elements/compare/v37.61.3...v37.61.4) (2024-09-20)
|
|
2
12
|
|
|
3
13
|
|
|
@@ -14,11 +14,14 @@ const translations = require('./translations-e12a6869.js');
|
|
|
14
14
|
const randomString = require('./random-string-c8445652.js');
|
|
15
15
|
const isItem = require('./isItem-3f8ad629.js');
|
|
16
16
|
const isEqual = require('./isEqual-b136e579.js');
|
|
17
|
+
const debounce = require('./debounce-2e5f4b7e.js');
|
|
17
18
|
require('./eq-9a943b00.js');
|
|
18
19
|
require('./_getNative-60328036.js');
|
|
19
20
|
require('./isArrayLike-ac53bdac.js');
|
|
20
21
|
require('./_defineProperty-8f56146d.js');
|
|
21
22
|
require('./_commonjsHelpers-0c557e26.js');
|
|
23
|
+
require('./toNumber-062ea29c.js');
|
|
24
|
+
require('./isSymbol-d22b2798.js');
|
|
22
25
|
|
|
23
26
|
/** Built-in value references. */
|
|
24
27
|
var objectCreate = Object.create;
|
|
@@ -26076,10 +26079,12 @@ const createActionBarInteractionPlugin = (menuCommandFactory) => {
|
|
|
26076
26079
|
|
|
26077
26080
|
const prosemirrorAdapterCss = "@charset \"UTF-8\";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host(limel-prosemirror-adapter){display:flex;flex-direction:column}:host(limel-prosemirror-adapter) .toolbar{order:1}:host(limel-prosemirror-adapter) div#editor{order:2;height:100%;flex-grow:1}:host(limel-prosemirror-adapter) div[contenteditable=true]{height:100%}*{box-sizing:border-box}:host(limel-prosemirror-adapter:hover) .toolbar,:host(limel-prosemirror-adapter:focus-within) .toolbar{will-change:grid-template-rows}:host(limel-prosemirror-adapter:hover) limel-action-bar,:host(limel-prosemirror-adapter:focus-within) limel-action-bar{will-change:opacity, padding}:host(limel-prosemirror-adapter:hover) .ProseMirror,:host(limel-prosemirror-adapter:focus-within) .ProseMirror{will-change:padding}.ProseMirror-menubar-wrapper{display:grid;grid-template-rows:auto 1fr}.ProseMirror-textblock-dropdown{min-width:3em}.ProseMirror-tooltip .ProseMirror-menu{width:-webkit-fit-content;width:fit-content;white-space:pre}.toolbar{--action-bar-border-radius:0.25rem;border-radius:var(--action-bar-border-radius);flex-shrink:0;position:sticky;z-index:1;top:0;width:100%;display:grid;grid-template-rows:var(--limel-prosemirror-adapter-toolbar-grid-template-rows);transition-property:grid-template-rows;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);background-color:rgba(var(--contrast-200), 0.5);backdrop-filter:blur(0.5rem);-webkit-backdrop-filter:blur(0.5rem)}limel-action-bar{min-width:0;transition-property:padding, opacity;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);opacity:var(--limel-prosemirror-adapter-toolbar-opacity);padding:var(--limel-prosemirror-adapter-action-bar-padding-top-bottom, 0.125rem) 0.25rem;background-color:transparent;overflow:hidden}.ProseMirror{transition-duration:padding;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);position:relative;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:\"liga\" 0;padding:var(--limel-text-editor-padding)}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror:focus-visible{outline:none}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-selectednode{outline:0.125rem solid rgb(var(--color-sky-light))}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:\"\";position:absolute;left:-2rem;right:-0.125rem;top:-0.125rem;bottom:-0.125rem;border:0.125rem solid rgb(var(--color-sky-light));pointer-events:none}img.ProseMirror-separator{display:inline !important;border:none !important;margin:0 !important}limel-portal{width:25rem}blockquote{position:relative;font-weight:100;font-size:0.875rem;max-width:100%;line-height:1.4;margin:0;padding:0.5rem 1.25rem;border-radius:0.05rem 0.75rem;background-color:rgb(var(--contrast-300))}blockquote:before,blockquote:after{position:absolute;font-size:2.75rem;opacity:0.4}blockquote:before{content:\"“\";left:0;top:-0.75rem}blockquote:after{content:\"”\";right:0;bottom:-2rem}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:0.875rem;word-break:break-word;hyphens:auto;-webkit-hyphens:auto}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:only-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:0.875rem;margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:0.875rem}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}ul{list-style:none}ul li{position:relative;margin-left:0.75rem}ul li:before{content:\"\";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{margin-bottom:0.25rem}code{font-family:ui-monospace, \"Cascadia Code\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace;font-size:0.8125rem;letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none;display:inline-block;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem;overflow:auto;white-space:pre-wrap}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0;border:1px solid rgb(var(--contrast-400))}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:0.875rem}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}";
|
|
26078
26081
|
|
|
26082
|
+
const DEBOUNCE_TIMEOUT = 300;
|
|
26079
26083
|
const ProsemirrorAdapter = class {
|
|
26080
26084
|
constructor(hostRef) {
|
|
26081
26085
|
index.registerInstance(this, hostRef);
|
|
26082
26086
|
this.change = index.createEvent(this, "change", 7);
|
|
26087
|
+
this.changeWaiting = false;
|
|
26083
26088
|
/**
|
|
26084
26089
|
* Used to stop change event emitting as result of getting updated value from consumer
|
|
26085
26090
|
*/
|
|
@@ -26109,13 +26114,16 @@ const ProsemirrorAdapter = class {
|
|
|
26109
26114
|
this.handleTransaction = (transaction) => {
|
|
26110
26115
|
const newState = this.view.state.apply(transaction);
|
|
26111
26116
|
this.view.updateState(newState);
|
|
26112
|
-
if (this.suppressChangeEvent) {
|
|
26117
|
+
if (this.suppressChangeEvent || transaction.getMeta('pointer')) {
|
|
26113
26118
|
return;
|
|
26114
26119
|
}
|
|
26115
|
-
|
|
26120
|
+
const content = this.contentConverter.serialize(this.view, this.schema);
|
|
26121
|
+
if (content === this.lastEmittedValue) {
|
|
26116
26122
|
return;
|
|
26117
26123
|
}
|
|
26118
|
-
this.
|
|
26124
|
+
this.lastEmittedValue = content;
|
|
26125
|
+
this.changeWaiting = true;
|
|
26126
|
+
this.changeEmitter(content);
|
|
26119
26127
|
};
|
|
26120
26128
|
this.handleActionBarItem = (event) => {
|
|
26121
26129
|
event.preventDefault();
|
|
@@ -26160,6 +26168,13 @@ const ProsemirrorAdapter = class {
|
|
|
26160
26168
|
this.link = { href: href, text: text };
|
|
26161
26169
|
this.isLinkMenuOpen = true;
|
|
26162
26170
|
};
|
|
26171
|
+
this.changeEmitter = debounce.debounce((value) => {
|
|
26172
|
+
this.change.emit(value);
|
|
26173
|
+
this.changeWaiting = false;
|
|
26174
|
+
}, DEBOUNCE_TIMEOUT);
|
|
26175
|
+
this.handleBlur = () => {
|
|
26176
|
+
this.changeEmitter.flush();
|
|
26177
|
+
};
|
|
26163
26178
|
this.contentType = 'markdown';
|
|
26164
26179
|
this.value = undefined;
|
|
26165
26180
|
this.language = undefined;
|
|
@@ -26170,10 +26185,19 @@ const ProsemirrorAdapter = class {
|
|
|
26170
26185
|
this.portalId = randomString.createRandomString();
|
|
26171
26186
|
}
|
|
26172
26187
|
watchValue(newValue) {
|
|
26173
|
-
if (!this.view
|
|
26174
|
-
|
|
26188
|
+
if (!this.view) {
|
|
26189
|
+
return;
|
|
26190
|
+
}
|
|
26191
|
+
if (this.changeWaiting) {
|
|
26192
|
+
// A change is pending; do not update the editor's content
|
|
26193
|
+
return;
|
|
26194
|
+
}
|
|
26195
|
+
const currentContent = this.contentConverter.serialize(this.view, this.schema);
|
|
26196
|
+
// If the new value is the same as the current content, do nothing
|
|
26197
|
+
if (newValue === currentContent) {
|
|
26175
26198
|
return;
|
|
26176
26199
|
}
|
|
26200
|
+
// Update the editor's content with the new value
|
|
26177
26201
|
this.updateView(newValue);
|
|
26178
26202
|
}
|
|
26179
26203
|
componentWillLoad() {
|
|
@@ -26195,8 +26219,10 @@ const ProsemirrorAdapter = class {
|
|
|
26195
26219
|
this.host.addEventListener('open-editor-link-menu', this.handleOpenLinkMenu);
|
|
26196
26220
|
}
|
|
26197
26221
|
disconnectedCallback() {
|
|
26222
|
+
var _a, _b, _c;
|
|
26198
26223
|
this.host.removeEventListener('open-editor-link-menu', this.handleOpenLinkMenu);
|
|
26199
|
-
this.view.
|
|
26224
|
+
(_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.removeEventListener('blur', this.handleBlur);
|
|
26225
|
+
(_c = this.view) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
26200
26226
|
}
|
|
26201
26227
|
render() {
|
|
26202
26228
|
return [
|
|
@@ -26230,6 +26256,7 @@ const ProsemirrorAdapter = class {
|
|
|
26230
26256
|
state: this.createEditorState(initialDoc),
|
|
26231
26257
|
dispatchTransaction: this.handleTransaction,
|
|
26232
26258
|
});
|
|
26259
|
+
this.view.dom.addEventListener('blur', this.handleBlur);
|
|
26233
26260
|
if (this.value) {
|
|
26234
26261
|
this.updateView(this.value);
|
|
26235
26262
|
}
|