@aquera/nile-elements 0.1.64-beta-1.2 → 0.1.65-beta-1.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/demo/index.html +29 -109
- package/dist/index.js +608 -547
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +45 -2
- package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rte-mentions.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rte-mentions.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rte-mentions.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rte-select.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rte-select.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rte-select.esm.js +31 -13
- package/dist/nile-rich-text-editor/utils.cjs.js +1 -1
- package/dist/nile-rich-text-editor/utils.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/utils.esm.js +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +43 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +3 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +81 -22
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rte-mentions.js +5 -0
- package/dist/src/nile-rich-text-editor/nile-rte-mentions.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rte-select.d.ts +15 -1
- package/dist/src/nile-rich-text-editor/nile-rte-select.js +85 -52
- package/dist/src/nile-rich-text-editor/nile-rte-select.js.map +1 -1
- package/dist/src/nile-rich-text-editor/utils.d.ts +1 -0
- package/dist/src/nile-rich-text-editor/utils.js +17 -0
- package/dist/src/nile-rich-text-editor/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +43 -0
- package/src/nile-rich-text-editor/nile-rich-text-editor.ts +112 -40
- package/src/nile-rich-text-editor/nile-rte-mentions.ts +5 -0
- package/src/nile-rich-text-editor/nile-rte-select.ts +97 -58
- package/src/nile-rich-text-editor/utils.ts +18 -0
- package/vscode-html-custom-data.json +3 -3
package/demo/index.html
CHANGED
@@ -50,11 +50,12 @@
|
|
50
50
|
{"value":"h5","label":"Heading 5"},
|
51
51
|
{"value":"h6","label":"Heading 6"}
|
52
52
|
]'></nile-rte-select>
|
53
|
-
|
54
53
|
<nile-rte-toolbar-item name="bold" label="Bold"></nile-rte-toolbar-item>
|
55
54
|
<nile-rte-toolbar-item name="italic" label="Italic"></nile-rte-toolbar-item>
|
56
55
|
<nile-rte-toolbar-item name="underline" label="Underline"></nile-rte-toolbar-item>
|
57
|
-
|
56
|
+
|
57
|
+
<nile-rte-color type="foreColor" label="Text" value="#000000"></nile-rte-color>
|
58
|
+
<nile-rte-color mode="background" label="Highlight" value="#ffff00"></nile-rte-color>
|
58
59
|
|
59
60
|
<nile-rte-select
|
60
61
|
type="font"
|
@@ -82,6 +83,7 @@
|
|
82
83
|
<nile-rte-toolbar-item name="ul" label="Bulleted list"></nile-rte-toolbar-item>
|
83
84
|
<nile-rte-toolbar-item name="ol" label="Numbered list"></nile-rte-toolbar-item>
|
84
85
|
<nile-rte-toolbar-item name="clear" label="Clear Formatting" ></nile-rte-toolbar-item>
|
86
|
+
<nile-rte-toolbar-item name="link" label="Link" ></nile-rte-toolbar-item>
|
85
87
|
</nile-rte-toolbar>
|
86
88
|
|
87
89
|
<!-- Optional live preview -->
|
@@ -90,88 +92,14 @@
|
|
90
92
|
|
91
93
|
</div>
|
92
94
|
|
93
|
-
<script>
|
94
|
-
|
95
|
-
document.addEventListener('content-changed', e => {
|
96
|
-
|
97
|
-
});
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
// @people
|
102
|
-
{
|
103
|
-
character: "@",
|
104
|
-
data: [
|
105
|
-
{ key: "alice", label: "Alice Smith" },
|
106
|
-
{ key: "bob", label: "Bob Jones" },
|
107
|
-
{ key: "charlie", label: "Charlie Kapoor" },
|
108
|
-
{ key: "diana", label: "Diana Sen" },
|
109
|
-
{ key: "eric", label: "Eric Das" }
|
110
|
-
]
|
111
|
-
},
|
112
|
-
// #tickets / issues
|
113
|
-
{
|
114
|
-
character: "#",
|
115
|
-
data: [
|
116
|
-
{ key: "ISSUE-101", label: "ISSUE-101: Login fails on Safari" },
|
117
|
-
{ key: "BUG-556", label: "BUG-556: NPE on save" },
|
118
|
-
{ key: "TASK-72", label: "TASK-72: Update docs" }
|
119
|
-
]
|
120
|
-
},
|
121
|
-
// :emoji
|
122
|
-
{
|
123
|
-
character: ":",
|
124
|
-
data: [
|
125
|
-
{ key: "thumbsup", label: "👍 thumbs up" },
|
126
|
-
{ key: "sparkles", label: "✨ sparkles" },
|
127
|
-
{ key: "tada", label: "🎉 tada" },
|
128
|
-
{ key: "fire", label: "🔥 fire" },
|
129
|
-
{ key: "warning", label: "⚠️ warning" }
|
130
|
-
]
|
131
|
-
},
|
132
|
-
// /commands
|
133
|
-
{
|
134
|
-
character: "/",
|
135
|
-
data: [
|
136
|
-
{ key: "assign-me", label: "Assign to me" },
|
137
|
-
{ key: "request-review",label: "Request review" },
|
138
|
-
{ key: "insert-date", label: "Insert date" },
|
139
|
-
{ key: "clear-format", label: "Clear formatting" }
|
140
|
-
]
|
141
|
-
},
|
142
|
-
// $variables (templating)
|
143
|
-
{
|
144
|
-
character: "$",
|
145
|
-
data: [
|
146
|
-
{ key: "firstName", label: "firstName" },
|
147
|
-
{ key: "lastName", label: "lastName" },
|
148
|
-
{ key: "email", label: "email" },
|
149
|
-
{ key: "today", label: "today" }
|
150
|
-
]
|
151
|
-
},
|
152
|
-
// !status
|
153
|
-
{
|
154
|
-
character: "!",
|
155
|
-
data: [
|
156
|
-
{ key: "high", label: "High Priority" },
|
157
|
-
{ key: "medium", label: "Medium Priority" },
|
158
|
-
{ key: "low", label: "Low Priority" }
|
159
|
-
]
|
160
|
-
},
|
161
|
-
|
162
|
-
{
|
163
|
-
character: "%",
|
164
|
-
data: [
|
165
|
-
{ key: "design", label: "{{design}}" },
|
166
|
-
{ key: "frontend", label: "frontend" },
|
167
|
-
{ key: "backend", label: "backend" },
|
168
|
-
{ key: "release", label: "release" }
|
169
|
-
]
|
170
|
-
}
|
171
|
-
];
|
172
|
-
|
173
|
-
|
174
|
-
async function setMentions(mentionsList) {
|
95
|
+
<script type="module">
|
96
|
+
// Optional: listen to editor content changes (keep if you already use it)
|
97
|
+
document.addEventListener('content-changed', e => {
|
98
|
+
console.log('Received from anywhere', e.detail.content);
|
99
|
+
});
|
100
|
+
|
101
|
+
window.addEventListener('DOMContentLoaded', async () => {
|
102
|
+
// Wait for the editor custom element to be ready
|
175
103
|
await customElements.whenDefined('nile-rich-text-editor');
|
176
104
|
|
177
105
|
const editor = document.querySelector('nile-rich-text-editor');
|
@@ -180,42 +108,34 @@ document.addEventListener('content-changed', e => {
|
|
180
108
|
return;
|
181
109
|
}
|
182
110
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
111
|
+
// Ensure there is a <nile-rte-mentions> inside the editor
|
112
|
+
let mentions = editor.querySelector('nile-rte-mentions');
|
113
|
+
if (!mentions) {
|
114
|
+
mentions = document.createElement('nile-rte-mentions');
|
115
|
+
// Put it as the first child of the editor so it's available early
|
116
|
+
editor.prepend(mentions);
|
187
117
|
}
|
188
118
|
|
189
|
-
// Clear existing
|
190
|
-
rteMentions.innerHTML = '';
|
191
|
-
|
192
|
-
// Add all items
|
193
|
-
mentionsList.forEach(group => {
|
194
|
-
const item = document.createElement('nile-rte-mentions-item');
|
195
119
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
});
|
120
|
+
const BIG_AT = Array.from({ length: 1000 }, (_, i) => ({
|
121
|
+
key: `user-${i + 1}`,
|
122
|
+
label: `User ${i + 1}`
|
123
|
+
}));
|
200
124
|
|
201
|
-
|
202
|
-
|
203
|
-
}
|
204
|
-
|
205
|
-
// 3) Call once DOM is ready
|
206
|
-
window.addEventListener('DOMContentLoaded', () => setMentions(MENTIONS_CATALOG));
|
125
|
+
|
126
|
+
mentions.setExternalConfig({ '@': BIG_AT });
|
207
127
|
|
208
128
|
|
209
|
-
|
210
|
-
|
211
|
-
const item = editor?.querySelector(`nile-rte-mentions-item[mentionscharacter="${character}"]`);
|
212
|
-
if (item) item.mentionsData = items;
|
213
|
-
}
|
129
|
+
mentions.mentionColors = { '@': '#eef2ff' };
|
130
|
+
|
214
131
|
|
132
|
+
editor.dispatchEvent(new CustomEvent('nile-mentions-updated', { bubbles: true, composed: true }));
|
133
|
+
});
|
215
134
|
</script>
|
216
135
|
|
217
136
|
|
218
137
|
|
138
|
+
|
219
139
|
</body>
|
220
140
|
|
221
141
|
</html>
|