@limetech/lime-elements 37.34.1 → 37.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +23 -0
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +26 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +23 -0
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-4ee849ec.entry.js → p-fecf1bf1.entry.js} +2 -2
- package/dist/lime-elements/p-fecf1bf1.entry.js.map +1 -0
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +2 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-4ee849ec.entry.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [37.35.0](https://github.com/Lundalogik/lime-elements/compare/v37.34.1...v37.35.0) (2024-05-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **text-editor:** use updateView() instead of injecting HTML directly for first value ([d00b089](https://github.com/Lundalogik/lime-elements/commit/d00b089791bd505a4888a5856acc84be047ffa51))
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* **text-editor:** add watcher for value prop ([de11735](https://github.com/Lundalogik/lime-elements/commit/de11735c19680afae23ea18845f84009048c5756))
|
|
13
|
+
|
|
1
14
|
## [37.34.1](https://github.com/Lundalogik/lime-elements/compare/v37.34.0...v37.34.1) (2024-05-16)
|
|
2
15
|
|
|
3
16
|
|
|
@@ -24747,6 +24747,9 @@ const ProsemirrorAdapter = class {
|
|
|
24747
24747
|
},
|
|
24748
24748
|
});
|
|
24749
24749
|
this.menuCommandFactory = new MenuCommandFactory(mySchema);
|
|
24750
|
+
if (this.value) {
|
|
24751
|
+
this.updateView(this.value);
|
|
24752
|
+
}
|
|
24750
24753
|
};
|
|
24751
24754
|
this.handleActionBarItem = (event) => {
|
|
24752
24755
|
event.preventDefault();
|
|
@@ -24765,6 +24768,13 @@ const ProsemirrorAdapter = class {
|
|
|
24765
24768
|
this.view = undefined;
|
|
24766
24769
|
this.actionBarItems = [];
|
|
24767
24770
|
}
|
|
24771
|
+
watchValue(newValue) {
|
|
24772
|
+
if (!this.view ||
|
|
24773
|
+
newValue === this.contentConverter.serialize(this.view, schema$1)) {
|
|
24774
|
+
return;
|
|
24775
|
+
}
|
|
24776
|
+
this.updateView(newValue);
|
|
24777
|
+
}
|
|
24768
24778
|
componentWillLoad() {
|
|
24769
24779
|
if (this.contentType === 'markdown') {
|
|
24770
24780
|
this.contentConverter = new markdownConverter();
|
|
@@ -24785,6 +24795,16 @@ const ProsemirrorAdapter = class {
|
|
|
24785
24795
|
index.h("limel-action-bar", { accessibleLabel: "Toolbar", actions: this.actionBarItems, onItemSelected: this.handleActionBarItem }),
|
|
24786
24796
|
];
|
|
24787
24797
|
}
|
|
24798
|
+
async updateView(content) {
|
|
24799
|
+
const html = await this.contentConverter.parseAsHTML(content, schema$1);
|
|
24800
|
+
const prosemirrorDOMparser = DOMParser.fromSchema(this.view.state.schema);
|
|
24801
|
+
const domParser = new window.DOMParser();
|
|
24802
|
+
const doc = domParser.parseFromString(html, 'text/html');
|
|
24803
|
+
const prosemirrorDoc = prosemirrorDOMparser.parse(doc.body);
|
|
24804
|
+
const tr = this.view.state.tr;
|
|
24805
|
+
tr.replaceWith(0, tr.doc.content.size, prosemirrorDoc.content);
|
|
24806
|
+
this.view.dispatch(tr);
|
|
24807
|
+
}
|
|
24788
24808
|
executeCommand(command) {
|
|
24789
24809
|
const { state } = this.view;
|
|
24790
24810
|
const selection = state.selection;
|
|
@@ -24799,6 +24819,9 @@ const ProsemirrorAdapter = class {
|
|
|
24799
24819
|
this.view.focus();
|
|
24800
24820
|
}
|
|
24801
24821
|
get host() { return index.getElement(this); }
|
|
24822
|
+
static get watchers() { return {
|
|
24823
|
+
"value": ["watchValue"]
|
|
24824
|
+
}; }
|
|
24802
24825
|
};
|
|
24803
24826
|
ProsemirrorAdapter.style = prosemirrorAdapterCss;
|
|
24804
24827
|
|