@mekari/pixel3-rich-text-editor 0.1.2 → 0.1.3-dev.1
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/dist/{chunk-7BEXEMOE.mjs → chunk-6O4HSL2C.mjs} +4 -0
- package/dist/chunk-76GEEOAG.mjs +189 -0
- package/dist/{chunk-MKTM47RO.mjs → chunk-AIWY3FHJ.mjs} +1 -1
- package/dist/chunk-BWRU2WZN.mjs +202 -0
- package/dist/{chunk-ZO6THAT6.mjs → chunk-COZ45QUD.mjs} +1 -1
- package/dist/chunk-ENKUUZPM.mjs +124 -0
- package/dist/{chunk-25RKPG44.mjs → chunk-FCLBNBXD.mjs} +25 -16
- package/dist/{chunk-Q7QLZISF.mjs → chunk-IFRJVX2K.mjs} +29 -1
- package/dist/{chunk-YE6FEVD4.mjs → chunk-RX7ZEE2M.mjs} +104 -58
- package/dist/{chunk-XNM3YX37.mjs → chunk-T7RFFPSJ.mjs} +13 -3
- package/dist/{chunk-YIEQVTEO.mjs → chunk-X2CB42A3.mjs} +1 -1
- package/dist/{chunk-5S2LSGJV.mjs → chunk-Y6UPQ6EU.mjs} +1 -1
- package/dist/{chunk-UBJOZ2IA.mjs → chunk-YWVVMJGP.mjs} +1 -1
- package/dist/editor-toolbar.d.mts +2 -1
- package/dist/editor-toolbar.d.ts +2 -1
- package/dist/editor-toolbar.js +469 -75
- package/dist/editor-toolbar.mjs +10 -8
- package/dist/extensions/align-extension.js +27 -0
- package/dist/extensions/align-extension.mjs +2 -2
- package/dist/extensions/color-extension.js +27 -0
- package/dist/extensions/color-extension.mjs +2 -2
- package/dist/extensions/heading-extension.js +27 -0
- package/dist/extensions/heading-extension.mjs +2 -2
- package/dist/extensions/icons.d.mts +2 -1
- package/dist/extensions/icons.d.ts +2 -1
- package/dist/extensions/icons.js +31 -2
- package/dist/extensions/icons.mjs +5 -3
- package/dist/extensions/index.d.mts +6 -0
- package/dist/extensions/index.d.ts +6 -0
- package/dist/extensions/index.js +368 -16
- package/dist/extensions/index.mjs +18 -10
- package/dist/extensions/link-extension.js +27 -0
- package/dist/extensions/link-extension.mjs +2 -2
- package/dist/extensions/single-extension.d.mts +12 -2
- package/dist/extensions/single-extension.d.ts +12 -2
- package/dist/extensions/single-extension.js +49 -14
- package/dist/extensions/single-extension.mjs +2 -2
- package/dist/extensions/variable-extension.d.mts +19 -0
- package/dist/extensions/variable-extension.d.ts +19 -0
- package/dist/extensions/variable-extension.js +158 -0
- package/dist/extensions/variable-extension.mjs +7 -0
- package/dist/extensions/variable-list-extension.d.mts +33 -0
- package/dist/extensions/variable-list-extension.d.ts +33 -0
- package/dist/extensions/variable-list-extension.js +210 -0
- package/dist/extensions/variable-list-extension.mjs +7 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +699 -116
- package/dist/index.mjs +14 -11
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/modules/rich-text-editor.props.d.mts +5 -1
- package/dist/modules/rich-text-editor.props.d.ts +5 -1
- package/dist/modules/rich-text-editor.props.js +4 -0
- package/dist/modules/rich-text-editor.props.mjs +1 -1
- package/dist/modules/rich-text-editor.types.d.mts +11 -3
- package/dist/modules/rich-text-editor.types.d.ts +11 -3
- package/dist/rich-text-editor.d.mts +10 -1
- package/dist/rich-text-editor.d.ts +10 -1
- package/dist/rich-text-editor.js +699 -116
- package/dist/rich-text-editor.mjs +14 -11
- package/dist/rte-style-provider.mjs +2 -2
- package/dist/rte-variable-suggestion.d.mts +11 -0
- package/dist/rte-variable-suggestion.d.ts +11 -0
- package/dist/rte-variable-suggestion.js +405 -0
- package/dist/rte-variable-suggestion.mjs +10 -0
- package/package.json +12 -12
- /package/dist/{chunk-VYCDVS5I.mjs → chunk-HIHIKPNN.mjs} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import { SuggestionOptions } from '@tiptap/suggestion';
|
|
3
|
+
|
|
4
|
+
type VariableOptions = {
|
|
5
|
+
HTMLAttributes: Record<string, unknown>;
|
|
6
|
+
renderLabel: (props: {
|
|
7
|
+
options: VariableOptions;
|
|
8
|
+
node: {
|
|
9
|
+
attrs: {
|
|
10
|
+
id: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}) => string;
|
|
15
|
+
suggestion: Omit<SuggestionOptions, 'editor'>;
|
|
16
|
+
};
|
|
17
|
+
declare const Variable: Node<VariableOptions, any>;
|
|
18
|
+
|
|
19
|
+
export { Variable, VariableOptions };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import { SuggestionOptions } from '@tiptap/suggestion';
|
|
3
|
+
|
|
4
|
+
type VariableOptions = {
|
|
5
|
+
HTMLAttributes: Record<string, unknown>;
|
|
6
|
+
renderLabel: (props: {
|
|
7
|
+
options: VariableOptions;
|
|
8
|
+
node: {
|
|
9
|
+
attrs: {
|
|
10
|
+
id: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}) => string;
|
|
15
|
+
suggestion: Omit<SuggestionOptions, 'editor'>;
|
|
16
|
+
};
|
|
17
|
+
declare const Variable: Node<VariableOptions, any>;
|
|
18
|
+
|
|
19
|
+
export { Variable, VariableOptions };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/extensions/variable-extension.ts
|
|
31
|
+
var variable_extension_exports = {};
|
|
32
|
+
__export(variable_extension_exports, {
|
|
33
|
+
Variable: () => Variable
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(variable_extension_exports);
|
|
36
|
+
var import_core = require("@tiptap/core");
|
|
37
|
+
var import_suggestion = __toESM(require("@tiptap/suggestion"));
|
|
38
|
+
var Variable = import_core.Node.create({
|
|
39
|
+
name: "variable",
|
|
40
|
+
addOptions() {
|
|
41
|
+
return {
|
|
42
|
+
HTMLAttributes: {},
|
|
43
|
+
renderLabel({
|
|
44
|
+
node
|
|
45
|
+
}) {
|
|
46
|
+
var _a;
|
|
47
|
+
return `{${(_a = node.attrs.label) != null ? _a : node.attrs.id}}`;
|
|
48
|
+
},
|
|
49
|
+
suggestion: {}
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
group: "inline",
|
|
53
|
+
inline: true,
|
|
54
|
+
selectable: false,
|
|
55
|
+
atom: true,
|
|
56
|
+
addAttributes() {
|
|
57
|
+
return {
|
|
58
|
+
id: {
|
|
59
|
+
default: null,
|
|
60
|
+
parseHTML: (element) => element.getAttribute("data-id"),
|
|
61
|
+
renderHTML: (attributes) => {
|
|
62
|
+
if (!attributes.id) {
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
"data-id": attributes.id
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
label: {
|
|
71
|
+
default: null,
|
|
72
|
+
parseHTML: (element) => element.getAttribute("data-label"),
|
|
73
|
+
renderHTML: (attributes) => {
|
|
74
|
+
if (!attributes.label) {
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
"data-label": attributes.label
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
category: {
|
|
83
|
+
default: null,
|
|
84
|
+
parseHTML: (element) => element.getAttribute("data-category"),
|
|
85
|
+
renderHTML: (attributes) => {
|
|
86
|
+
if (!attributes.category) {
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
"data-category": attributes.category
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
parseHTML() {
|
|
97
|
+
return [{
|
|
98
|
+
tag: `span[data-type="${this.name}"]`
|
|
99
|
+
}];
|
|
100
|
+
},
|
|
101
|
+
renderHTML({
|
|
102
|
+
node,
|
|
103
|
+
HTMLAttributes
|
|
104
|
+
}) {
|
|
105
|
+
return ["span", (0, import_core.mergeAttributes)({
|
|
106
|
+
"data-type": this.name
|
|
107
|
+
}, this.options.HTMLAttributes, HTMLAttributes), this.options.renderLabel({
|
|
108
|
+
options: this.options,
|
|
109
|
+
node
|
|
110
|
+
})];
|
|
111
|
+
},
|
|
112
|
+
renderText({
|
|
113
|
+
node
|
|
114
|
+
}) {
|
|
115
|
+
return this.options.renderLabel({
|
|
116
|
+
options: this.options,
|
|
117
|
+
node
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
addKeyboardShortcuts() {
|
|
121
|
+
return {
|
|
122
|
+
Backspace: () => this.editor.commands.command(({
|
|
123
|
+
tr,
|
|
124
|
+
state
|
|
125
|
+
}) => {
|
|
126
|
+
let isVariable = false;
|
|
127
|
+
const {
|
|
128
|
+
selection
|
|
129
|
+
} = state;
|
|
130
|
+
const {
|
|
131
|
+
empty,
|
|
132
|
+
anchor
|
|
133
|
+
} = selection;
|
|
134
|
+
if (!empty) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {
|
|
138
|
+
if (node.type.name === this.name) {
|
|
139
|
+
isVariable = true;
|
|
140
|
+
tr.insertText(this.options.suggestion.char || "", pos, pos + node.nodeSize);
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return isVariable;
|
|
145
|
+
})
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
addProseMirrorPlugins() {
|
|
149
|
+
return [(0, import_suggestion.default)({
|
|
150
|
+
editor: this.editor,
|
|
151
|
+
...this.options.suggestion
|
|
152
|
+
})];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
+
0 && (module.exports = {
|
|
157
|
+
Variable
|
|
158
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
4
|
+
import { VariableSuggestionItem } from '../modules/rich-text-editor.types.mjs';
|
|
5
|
+
import '@mekari/pixel3-utils';
|
|
6
|
+
|
|
7
|
+
declare const VariableList: vue.DefineComponent<{
|
|
8
|
+
items: {
|
|
9
|
+
type: PropType<VariableSuggestionItem[]>;
|
|
10
|
+
default: () => never[];
|
|
11
|
+
};
|
|
12
|
+
command: {
|
|
13
|
+
type: PropType<(item: VariableSuggestionItem & {
|
|
14
|
+
label?: string;
|
|
15
|
+
}) => void>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
19
|
+
items: {
|
|
20
|
+
type: PropType<VariableSuggestionItem[]>;
|
|
21
|
+
default: () => never[];
|
|
22
|
+
};
|
|
23
|
+
command: {
|
|
24
|
+
type: PropType<(item: VariableSuggestionItem & {
|
|
25
|
+
label?: string;
|
|
26
|
+
}) => void>;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
}>>, {
|
|
30
|
+
items: VariableSuggestionItem[];
|
|
31
|
+
}, {}>;
|
|
32
|
+
|
|
33
|
+
export { VariableList };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
4
|
+
import { VariableSuggestionItem } from '../modules/rich-text-editor.types.js';
|
|
5
|
+
import '@mekari/pixel3-utils';
|
|
6
|
+
|
|
7
|
+
declare const VariableList: vue.DefineComponent<{
|
|
8
|
+
items: {
|
|
9
|
+
type: PropType<VariableSuggestionItem[]>;
|
|
10
|
+
default: () => never[];
|
|
11
|
+
};
|
|
12
|
+
command: {
|
|
13
|
+
type: PropType<(item: VariableSuggestionItem & {
|
|
14
|
+
label?: string;
|
|
15
|
+
}) => void>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
19
|
+
items: {
|
|
20
|
+
type: PropType<VariableSuggestionItem[]>;
|
|
21
|
+
default: () => never[];
|
|
22
|
+
};
|
|
23
|
+
command: {
|
|
24
|
+
type: PropType<(item: VariableSuggestionItem & {
|
|
25
|
+
label?: string;
|
|
26
|
+
}) => void>;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
}>>, {
|
|
30
|
+
items: VariableSuggestionItem[];
|
|
31
|
+
}, {}>;
|
|
32
|
+
|
|
33
|
+
export { VariableList };
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/extensions/variable-list-extension.tsx
|
|
22
|
+
var variable_list_extension_exports = {};
|
|
23
|
+
__export(variable_list_extension_exports, {
|
|
24
|
+
VariableList: () => VariableList
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(variable_list_extension_exports);
|
|
27
|
+
var import_vue = require("vue");
|
|
28
|
+
var import_vue2 = require("vue");
|
|
29
|
+
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
30
|
+
var import_pixel3_popover = require("@mekari/pixel3-popover");
|
|
31
|
+
var import_pixel3_text = require("@mekari/pixel3-text");
|
|
32
|
+
var VariableList = (0, import_vue2.defineComponent)({
|
|
33
|
+
name: "VariableList",
|
|
34
|
+
props: {
|
|
35
|
+
items: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: () => []
|
|
38
|
+
},
|
|
39
|
+
command: {
|
|
40
|
+
type: Function,
|
|
41
|
+
required: true
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
setup(props, {
|
|
45
|
+
expose
|
|
46
|
+
}) {
|
|
47
|
+
const selectedIndex = (0, import_vue2.ref)(0);
|
|
48
|
+
const listRef = (0, import_vue2.ref)(null);
|
|
49
|
+
const groupedItems = (0, import_vue2.computed)(() => {
|
|
50
|
+
const groups = {};
|
|
51
|
+
props.items.forEach((item) => {
|
|
52
|
+
const category = item.category || "OTHER";
|
|
53
|
+
if (!groups[category]) {
|
|
54
|
+
groups[category] = [];
|
|
55
|
+
}
|
|
56
|
+
groups[category].push(item);
|
|
57
|
+
});
|
|
58
|
+
return Object.entries(groups).map(([category, items]) => ({
|
|
59
|
+
category,
|
|
60
|
+
items
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
63
|
+
const scrollToFocusedItem = /* @__PURE__ */ __name(() => {
|
|
64
|
+
(0, import_vue2.nextTick)(() => {
|
|
65
|
+
if (!listRef.value)
|
|
66
|
+
return;
|
|
67
|
+
const targetItem = listRef.value.querySelector('[data-active="true"], [data-highlight]');
|
|
68
|
+
if (targetItem) {
|
|
69
|
+
targetItem.scrollIntoView({
|
|
70
|
+
block: "nearest"
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}, "scrollToFocusedItem");
|
|
75
|
+
(0, import_vue2.watch)(() => props.items, () => {
|
|
76
|
+
selectedIndex.value = 0;
|
|
77
|
+
});
|
|
78
|
+
const onSelect = /* @__PURE__ */ __name((index) => {
|
|
79
|
+
const item = props.items[index];
|
|
80
|
+
if (item) {
|
|
81
|
+
props.command({
|
|
82
|
+
...item,
|
|
83
|
+
label: item.id
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, "onSelect");
|
|
87
|
+
const onKeyDown = /* @__PURE__ */ __name(({
|
|
88
|
+
event
|
|
89
|
+
}) => {
|
|
90
|
+
if (!props.items.length) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
if (event.key === "ArrowUp") {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
const total = props.items.length;
|
|
96
|
+
selectedIndex.value = (selectedIndex.value + total - 1) % total;
|
|
97
|
+
scrollToFocusedItem();
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
if (event.key === "ArrowDown") {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
selectedIndex.value = (selectedIndex.value + 1) % props.items.length;
|
|
103
|
+
scrollToFocusedItem();
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
if (event.key === "Enter") {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
onSelect(selectedIndex.value);
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}, "onKeyDown");
|
|
113
|
+
expose({
|
|
114
|
+
onKeyDown
|
|
115
|
+
});
|
|
116
|
+
return () => (0, import_vue.createVNode)(import_pixel3_popover.MpPopover, {
|
|
117
|
+
"id": "popover-rte-variable-list",
|
|
118
|
+
"is-manual": true,
|
|
119
|
+
"is-default-open": true,
|
|
120
|
+
"is-open": true
|
|
121
|
+
}, {
|
|
122
|
+
default: () => [(0, import_vue.createVNode)(import_pixel3_popover.MpPopoverContent, {
|
|
123
|
+
"class": (0, import_css.css)({
|
|
124
|
+
width: "280px",
|
|
125
|
+
maxHeight: "284px",
|
|
126
|
+
overflowY: "auto"
|
|
127
|
+
})
|
|
128
|
+
}, {
|
|
129
|
+
default: () => [(0, import_vue.createVNode)(import_pixel3_popover.MpPopoverList, {
|
|
130
|
+
"ref": (element) => {
|
|
131
|
+
var _a;
|
|
132
|
+
if (!element) {
|
|
133
|
+
listRef.value = null;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
listRef.value = (_a = element.$el) != null ? _a : element;
|
|
137
|
+
},
|
|
138
|
+
"data-pixel-rte": true
|
|
139
|
+
}, {
|
|
140
|
+
default: () => [!props.items.length && (0, import_vue.createVNode)(import_pixel3_text.MpText, {
|
|
141
|
+
"color": "text.secondary",
|
|
142
|
+
"class": (0, import_css.css)({
|
|
143
|
+
px: "3",
|
|
144
|
+
py: "2"
|
|
145
|
+
})
|
|
146
|
+
}, {
|
|
147
|
+
default: () => [(0, import_vue.createTextVNode)("No result")]
|
|
148
|
+
}), groupedItems.value.map((group) => {
|
|
149
|
+
return (0, import_vue.createVNode)(import_vue.Fragment, null, [(0, import_vue.createVNode)(import_pixel3_text.MpText, {
|
|
150
|
+
"size": "label-small",
|
|
151
|
+
"color": "text.secondary",
|
|
152
|
+
"class": (0, import_css.css)({
|
|
153
|
+
px: "3",
|
|
154
|
+
py: "2",
|
|
155
|
+
textTransform: "uppercase",
|
|
156
|
+
textAlign: "left",
|
|
157
|
+
letterSpacing: "0.05em",
|
|
158
|
+
display: "block",
|
|
159
|
+
width: "full"
|
|
160
|
+
})
|
|
161
|
+
}, {
|
|
162
|
+
default: () => [group.category]
|
|
163
|
+
}), group.items.map((item) => {
|
|
164
|
+
const itemIndex = props.items.indexOf(item);
|
|
165
|
+
return (0, import_vue.createVNode)(import_pixel3_popover.MpPopoverListItem, {
|
|
166
|
+
"key": `${item.id}-${itemIndex}`,
|
|
167
|
+
"onMousedown": (event) => event.preventDefault(),
|
|
168
|
+
"onMouseenter": () => {
|
|
169
|
+
selectedIndex.value = itemIndex;
|
|
170
|
+
},
|
|
171
|
+
"onClick": () => {
|
|
172
|
+
onSelect(itemIndex);
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
default: () => [(0, import_vue.createVNode)("div", {
|
|
176
|
+
"class": (0, import_css.css)({
|
|
177
|
+
display: "flex",
|
|
178
|
+
flexDirection: "column",
|
|
179
|
+
alignItems: "flex-start",
|
|
180
|
+
minWidth: "0",
|
|
181
|
+
width: "full",
|
|
182
|
+
gap: "0.5"
|
|
183
|
+
})
|
|
184
|
+
}, [(0, import_vue.createVNode)(import_pixel3_text.MpText, {
|
|
185
|
+
"size": "label",
|
|
186
|
+
"is-truncated": true
|
|
187
|
+
}, {
|
|
188
|
+
default: () => [item.name || "Unknown"]
|
|
189
|
+
}), (0, import_vue.createVNode)(import_pixel3_text.MpText, {
|
|
190
|
+
"size": "label-small",
|
|
191
|
+
"color": "text.secondary",
|
|
192
|
+
"is-truncated": true,
|
|
193
|
+
"class": (0, import_css.css)({
|
|
194
|
+
fontFamily: "mono"
|
|
195
|
+
})
|
|
196
|
+
}, {
|
|
197
|
+
default: () => [`{${item.id}}`]
|
|
198
|
+
})])]
|
|
199
|
+
});
|
|
200
|
+
})]);
|
|
201
|
+
})]
|
|
202
|
+
})]
|
|
203
|
+
})]
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
208
|
+
0 && (module.exports = {
|
|
209
|
+
VariableList
|
|
210
|
+
});
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { MpRichTextEditor } from './rich-text-editor.mjs';
|
|
2
2
|
export { MpRTEStyleProvider } from './rte-style-provider.mjs';
|
|
3
|
-
export { ActionTypes, ItemOptions, Items, MentionSuggestionItem, RTEStyleProviderApiMachine, RTEStyleProviderClasses, RTEStyleProviderDefinedContext, RTEStyleProviderState, RichTextEditorApiMachine, RichTextEditorClasses, RichTextEditorDefinedContext, RichTextEditorProps, RichTextEditorState, RteStyleProviderProps, ToolbarOption, ToolbarOptionObject } from './modules/rich-text-editor.types.mjs';
|
|
3
|
+
export { ActionTypes, ItemOptions, Items, MentionSuggestionItem, RTEStyleProviderApiMachine, RTEStyleProviderClasses, RTEStyleProviderDefinedContext, RTEStyleProviderState, RichTextEditorApiMachine, RichTextEditorClasses, RichTextEditorDefinedContext, RichTextEditorProps, RichTextEditorState, RteStyleProviderProps, ToolbarOption, ToolbarOptionObject, VariableSuggestionItem } from './modules/rich-text-editor.types.mjs';
|
|
4
4
|
import 'vue/jsx-runtime';
|
|
5
5
|
import 'vue';
|
|
6
6
|
import '@mekari/pixel3-utils';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { MpRichTextEditor } from './rich-text-editor.js';
|
|
2
2
|
export { MpRTEStyleProvider } from './rte-style-provider.js';
|
|
3
|
-
export { ActionTypes, ItemOptions, Items, MentionSuggestionItem, RTEStyleProviderApiMachine, RTEStyleProviderClasses, RTEStyleProviderDefinedContext, RTEStyleProviderState, RichTextEditorApiMachine, RichTextEditorClasses, RichTextEditorDefinedContext, RichTextEditorProps, RichTextEditorState, RteStyleProviderProps, ToolbarOption, ToolbarOptionObject } from './modules/rich-text-editor.types.js';
|
|
3
|
+
export { ActionTypes, ItemOptions, Items, MentionSuggestionItem, RTEStyleProviderApiMachine, RTEStyleProviderClasses, RTEStyleProviderDefinedContext, RTEStyleProviderState, RichTextEditorApiMachine, RichTextEditorClasses, RichTextEditorDefinedContext, RichTextEditorProps, RichTextEditorState, RteStyleProviderProps, ToolbarOption, ToolbarOptionObject, VariableSuggestionItem } from './modules/rich-text-editor.types.js';
|
|
4
4
|
import 'vue/jsx-runtime';
|
|
5
5
|
import 'vue';
|
|
6
6
|
import '@mekari/pixel3-utils';
|