@limetech/lime-elements 37.53.3 → 37.53.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 +16 -0
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +28 -13
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-commands.js +28 -13
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-commands.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +28 -13
- 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-20017fe1.entry.js → p-947478e0.entry.js} +2 -2
- package/dist/lime-elements/p-947478e0.entry.js.map +1 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-20017fe1.entry.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [37.53.5](https://github.com/Lundalogik/lime-elements/compare/v37.53.4...v37.53.5) (2024-07-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **editor menu:** allow block quotes to be toggled ([169e520](https://github.com/Lundalogik/lime-elements/commit/169e52087190c7c654715f589c1c028563dfdaec))
|
|
8
|
+
|
|
9
|
+
## [37.53.4](https://github.com/Lundalogik/lime-elements/compare/v37.53.3...v37.53.4) (2024-07-04)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* **text-editor:** ensure the link menu is correctly displayed ([40cbd32](https://github.com/Lundalogik/lime-elements/commit/40cbd32d343f7efe773f7935ca55fec1eafa8169))
|
|
16
|
+
|
|
1
17
|
## [37.53.3](https://github.com/Lundalogik/lime-elements/compare/v37.53.2...v37.53.3) (2024-07-03)
|
|
2
18
|
|
|
3
19
|
|
|
@@ -16655,25 +16655,40 @@ const getAttributes = (markName, link) => {
|
|
|
16655
16655
|
const isExternalLink = (url) => {
|
|
16656
16656
|
return !url.startsWith(window.location.origin);
|
|
16657
16657
|
};
|
|
16658
|
-
|
|
16659
|
-
|
|
16658
|
+
/**
|
|
16659
|
+
* Toggles or wraps a node type based on the selection and parameters.
|
|
16660
|
+
* - Toggles to paragraph if the selection is of the specified type.
|
|
16661
|
+
* - Lifts content out if already wrapped in the specified type.
|
|
16662
|
+
* - Wraps or sets the selection to the specified type based on `shouldWrap`.
|
|
16663
|
+
* @param schema - ProseMirror schema.
|
|
16664
|
+
* @param type - Block type name to toggle.
|
|
16665
|
+
* @param attrs - Attributes for the block type.
|
|
16666
|
+
* @param shouldWrap - Wrap selection if true, otherwise directly set the block type for the selection.
|
|
16667
|
+
* @returns A command based on selection and action needed.
|
|
16668
|
+
*/
|
|
16669
|
+
const toggleNodeType = (schema, type, attrs = {}, shouldWrap = false) => {
|
|
16670
|
+
const nodeType = schema.nodes[type];
|
|
16660
16671
|
const paragraphType = schema.nodes.paragraph;
|
|
16661
16672
|
return (state, dispatch) => {
|
|
16662
|
-
const { $from, to } = state.selection;
|
|
16673
|
+
const { $from, $to } = state.selection;
|
|
16674
|
+
const hasActiveWrap = $from.node($from.depth - 1).type === nodeType;
|
|
16663
16675
|
if (state.selection instanceof TextSelection &&
|
|
16664
|
-
$from.sameParent($from.doc.resolve(to))) {
|
|
16665
|
-
if ($from.parent.type ===
|
|
16676
|
+
$from.sameParent($from.doc.resolve($to.pos))) {
|
|
16677
|
+
if ($from.parent.type === nodeType) {
|
|
16666
16678
|
if (dispatch) {
|
|
16667
|
-
dispatch(state.tr.setBlockType($from.pos, to, paragraphType));
|
|
16679
|
+
dispatch(state.tr.setBlockType($from.pos, $to.pos, paragraphType));
|
|
16668
16680
|
}
|
|
16669
16681
|
return true;
|
|
16670
16682
|
}
|
|
16671
16683
|
else {
|
|
16672
|
-
if (
|
|
16673
|
-
return
|
|
16684
|
+
if (hasActiveWrap) {
|
|
16685
|
+
return lift(state, dispatch);
|
|
16686
|
+
}
|
|
16687
|
+
if (shouldWrap) {
|
|
16688
|
+
return wrapIn(nodeType, attrs)(state, dispatch);
|
|
16674
16689
|
}
|
|
16675
16690
|
else {
|
|
16676
|
-
return setBlockType(
|
|
16691
|
+
return setBlockType(nodeType, attrs)(state, dispatch);
|
|
16677
16692
|
}
|
|
16678
16693
|
}
|
|
16679
16694
|
}
|
|
@@ -16696,12 +16711,12 @@ const createSetNodeTypeCommand = (schema, nodeType, level) => {
|
|
|
16696
16711
|
}
|
|
16697
16712
|
let command;
|
|
16698
16713
|
if (nodeType === LevelMapping.Heading && level) {
|
|
16699
|
-
command =
|
|
16714
|
+
command = toggleNodeType(schema, LevelMapping.Heading, {
|
|
16700
16715
|
level: level,
|
|
16701
16716
|
});
|
|
16702
16717
|
}
|
|
16703
16718
|
else if (nodeType === EditorMenuTypes.CodeBlock) {
|
|
16704
|
-
command =
|
|
16719
|
+
command = toggleNodeType(schema, EditorMenuTypes.CodeBlock);
|
|
16705
16720
|
}
|
|
16706
16721
|
else {
|
|
16707
16722
|
command = setBlockType(type);
|
|
@@ -16716,7 +16731,7 @@ const createWrapInCommand = (schema, nodeType) => {
|
|
|
16716
16731
|
}
|
|
16717
16732
|
let command;
|
|
16718
16733
|
if (nodeType === EditorMenuTypes.Blockquote) {
|
|
16719
|
-
command =
|
|
16734
|
+
command = toggleNodeType(schema, EditorMenuTypes.Blockquote, {}, true);
|
|
16720
16735
|
}
|
|
16721
16736
|
else {
|
|
16722
16737
|
command = wrapIn(type);
|
|
@@ -26096,7 +26111,7 @@ const ProsemirrorAdapter = class {
|
|
|
26096
26111
|
if (!this.isLinkMenuOpen) {
|
|
26097
26112
|
return;
|
|
26098
26113
|
}
|
|
26099
|
-
return (index.h("limel-portal", { containerId: this.portalId, visible: this.isLinkMenuOpen, openDirection: "top", inheritParentWidth: true, anchor: this.actionBarElement
|
|
26114
|
+
return (index.h("limel-portal", { containerId: this.portalId, visible: this.isLinkMenuOpen, openDirection: "top", inheritParentWidth: true, anchor: this.actionBarElement }, index.h("limel-text-editor-link-menu", { link: this.link, isOpen: this.isLinkMenuOpen, onLinkChange: this.handleLinkChange, onCancel: this.handleCancelLinkMenu, onSave: this.handleSaveLinkMenu })));
|
|
26100
26115
|
}
|
|
26101
26116
|
setupContentConverter() {
|
|
26102
26117
|
if (this.contentType === 'markdown') {
|