@mixd-id/web-scaffold 0.1.230406335 → 0.1.230406336
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/package.json
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
<div :class="$style.comp">
|
|
3
3
|
|
|
4
4
|
<div class="flex flex-row items-start">
|
|
5
|
-
<
|
|
5
|
+
<span contenteditable="true" spellcheck="false"
|
|
6
6
|
ref="html"
|
|
7
7
|
v-html="html"
|
|
8
|
-
:class="itemClass"
|
|
9
|
-
@keydown="onKeyDown"
|
|
8
|
+
:class="`${$style.content}${itemClass ? ' ' + itemClass : ''}`"
|
|
10
9
|
@blur="saveSelection($refs.html)"
|
|
11
|
-
@input="onInput"></
|
|
10
|
+
@input="onInput"></span>
|
|
12
11
|
|
|
13
12
|
<button v-if="variant === 'minimal'" type="button" class="p-3" @click="$refs.modal.open()">
|
|
14
13
|
<svg width="14" height="14" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg>
|
|
@@ -172,20 +171,6 @@ export default{
|
|
|
172
171
|
this.addItem(item)
|
|
173
172
|
},
|
|
174
173
|
|
|
175
|
-
onKeyDown(e){
|
|
176
|
-
if (e.key === 'Enter') {
|
|
177
|
-
e.preventDefault();
|
|
178
|
-
document.execCommand('insertLineBreak');
|
|
179
|
-
|
|
180
|
-
const selection = window.getSelection();
|
|
181
|
-
const range = selection.getRangeAt(0);
|
|
182
|
-
range.setStartAfter(range.endContainer);
|
|
183
|
-
range.collapse(true);
|
|
184
|
-
selection.removeAllRanges();
|
|
185
|
-
selection.addRange(range);
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
|
|
189
174
|
remove(e){
|
|
190
175
|
e.target.parentNode.removeChild(e.target)
|
|
191
176
|
},
|
|
@@ -193,6 +178,7 @@ export default{
|
|
|
193
178
|
onInput(){
|
|
194
179
|
|
|
195
180
|
const arr = []
|
|
181
|
+
console.log(this.$refs.html.childNodes)
|
|
196
182
|
for(let i = 0 ; i < this.$refs.html.childNodes.length ; i++){
|
|
197
183
|
if(this.$refs.html.childNodes[i].nodeType === 3){
|
|
198
184
|
arr.push(this.$refs.html.childNodes[i].nodeValue)
|
|
@@ -202,7 +188,7 @@ export default{
|
|
|
202
188
|
}
|
|
203
189
|
}
|
|
204
190
|
|
|
205
|
-
const text = arr.filter(_ => _).join('')
|
|
191
|
+
const text = arr.filter(_ => _).join('')
|
|
206
192
|
|
|
207
193
|
this.$emit('update:modelValue', text)
|
|
208
194
|
|
|
@@ -256,8 +242,8 @@ export default{
|
|
|
256
242
|
@apply divide-y divide-text-100;
|
|
257
243
|
}
|
|
258
244
|
|
|
259
|
-
.
|
|
260
|
-
@apply outline-none p-2
|
|
245
|
+
.content{
|
|
246
|
+
@apply flex-1 whitespace-pre-line outline-none p-2;
|
|
261
247
|
}
|
|
262
248
|
|
|
263
249
|
.comp .tag{
|