@limetech/lime-elements 38.5.0 → 38.6.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 +8 -0
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +12 -8
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-commands.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/menu-state-tracking-plugin.js +8 -6
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/menu-state-tracking-plugin.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +3 -3
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +12 -8
- 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-d7f22e4e.entry.js → p-aacbd012.entry.js} +2 -2
- package/dist/lime-elements/p-aacbd012.entry.js.map +1 -0
- package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-commands.d.ts +1 -0
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/menu-state-tracking-plugin.d.ts +7 -2
- package/package.json +8 -8
- package/dist/lime-elements/p-d7f22e4e.entry.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [38.6.0](https://github.com/Lundalogik/lime-elements/compare/v38.5.0...v38.6.0) (2025-03-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **text editor:** conditionally allow commands ([819f599](https://github.com/Lundalogik/lime-elements/commit/819f599835de1859f0b8bb19b772c5cf6e5a51f6))
|
|
8
|
+
|
|
1
9
|
## [38.5.0](https://github.com/Lundalogik/lime-elements/compare/v38.4.1...v38.5.0) (2025-03-19)
|
|
2
10
|
|
|
3
11
|
|
|
@@ -13296,6 +13296,7 @@ const marks = {
|
|
|
13296
13296
|
Code font mark. Represented as a `<code>` element.
|
|
13297
13297
|
*/
|
|
13298
13298
|
code: {
|
|
13299
|
+
code: true,
|
|
13299
13300
|
parseDOM: [{ tag: "code" }],
|
|
13300
13301
|
toDOM() { return codeDOM; }
|
|
13301
13302
|
}
|
|
@@ -25179,6 +25180,7 @@ const schema = new Schema({
|
|
|
25179
25180
|
toDOM(node) { return ["a", node.attrs]; }
|
|
25180
25181
|
},
|
|
25181
25182
|
code: {
|
|
25183
|
+
code: true,
|
|
25182
25184
|
parseDOM: [{ tag: "code" }],
|
|
25183
25185
|
toDOM() { return ["code"]; }
|
|
25184
25186
|
}
|
|
@@ -26629,19 +26631,21 @@ class ImageView {
|
|
|
26629
26631
|
const actionBarPluginKey = new PluginKey('actionBarPlugin');
|
|
26630
26632
|
const getMenuItemStates = (menuTypes, menuCommandFactory, view) => {
|
|
26631
26633
|
const activeTypes = {};
|
|
26634
|
+
const allowedTypes = {};
|
|
26632
26635
|
menuTypes.forEach((type) => {
|
|
26636
|
+
var _a, _b, _c;
|
|
26633
26637
|
const command = menuCommandFactory.getCommand(type);
|
|
26634
|
-
activeTypes[type] =
|
|
26635
|
-
|
|
26638
|
+
activeTypes[type] = !!((_a = command === null || command === void 0 ? void 0 : command.active) === null || _a === void 0 ? void 0 : _a.call(command, view.state)) || false;
|
|
26639
|
+
allowedTypes[type] = !!((_c = (_b = command === null || command === void 0 ? void 0 : command.allowed) === null || _b === void 0 ? void 0 : _b.call(command, view.state)) !== null && _c !== void 0 ? _c : true);
|
|
26636
26640
|
});
|
|
26637
|
-
return activeTypes;
|
|
26641
|
+
return { active: activeTypes, allowed: allowedTypes };
|
|
26638
26642
|
};
|
|
26639
26643
|
const createMenuStateTrackingPlugin = (menuTypes, menuCommandFactory, updateCallback) => {
|
|
26640
26644
|
return new Plugin({
|
|
26641
26645
|
key: actionBarPluginKey,
|
|
26642
26646
|
state: {
|
|
26643
26647
|
init: () => {
|
|
26644
|
-
return {};
|
|
26648
|
+
return { active: {}, allowed: {} };
|
|
26645
26649
|
},
|
|
26646
26650
|
apply: (tr, menuStates) => {
|
|
26647
26651
|
const newMenuStates = tr.getMeta(actionBarPluginKey);
|
|
@@ -26655,7 +26659,7 @@ const createMenuStateTrackingPlugin = (menuTypes, menuCommandFactory, updateCall
|
|
|
26655
26659
|
if (!isEqual.isEqual(oldItemStates, menuItemStates)) {
|
|
26656
26660
|
const tr = view.state.tr.setMeta(actionBarPluginKey, menuItemStates);
|
|
26657
26661
|
view.dispatch(tr);
|
|
26658
|
-
updateCallback(menuItemStates);
|
|
26662
|
+
updateCallback(menuItemStates.active, menuItemStates.allowed);
|
|
26659
26663
|
}
|
|
26660
26664
|
},
|
|
26661
26665
|
}),
|
|
@@ -28343,14 +28347,14 @@ const ProsemirrorAdapter = class {
|
|
|
28343
28347
|
}
|
|
28344
28348
|
return newItem;
|
|
28345
28349
|
};
|
|
28346
|
-
this.updateActiveActionBarItems = (activeTypes) => {
|
|
28350
|
+
this.updateActiveActionBarItems = (activeTypes, allowedTypes) => {
|
|
28347
28351
|
const newItems = getTextEditorMenuItems().map((item) => {
|
|
28348
28352
|
if (isItem.isItem(item)) {
|
|
28349
|
-
return Object.assign(Object.assign({}, item), { selected: activeTypes[item.value] });
|
|
28353
|
+
return Object.assign(Object.assign({}, item), { selected: activeTypes[item.value], allowed: allowedTypes[item.value] });
|
|
28350
28354
|
}
|
|
28351
28355
|
return item;
|
|
28352
28356
|
});
|
|
28353
|
-
this.actionBarItems = newItems;
|
|
28357
|
+
this.actionBarItems = newItems.filter((item) => isItem.isItem(item) ? item.allowed : true);
|
|
28354
28358
|
};
|
|
28355
28359
|
this.handleTransaction = (transaction) => {
|
|
28356
28360
|
const newState = this.view.state.apply(transaction);
|