@mixd-id/web-scaffold 0.1.230406335 → 0.1.230406337

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406335",
4
+ "version": "0.1.230406337",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -2,13 +2,12 @@
2
2
  <div :class="$style.comp">
3
3
 
4
4
  <div class="flex flex-row items-start">
5
- <p contenteditable="true" spellcheck="false" class="flex-1 whitespace-pre-wrap"
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"></p>
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>
@@ -138,8 +137,6 @@ export default{
138
137
  addItem(item){
139
138
  this.restoreSelection()
140
139
 
141
- console.log(item)
142
-
143
140
  const el = document.createElement('span')
144
141
  el.setAttribute('contenteditable', 'false')
145
142
  el.setAttribute('class', this.$style.tag)
@@ -172,20 +169,6 @@ export default{
172
169
  this.addItem(item)
173
170
  },
174
171
 
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
172
  remove(e){
190
173
  e.target.parentNode.removeChild(e.target)
191
174
  },
@@ -202,7 +185,7 @@ export default{
202
185
  }
203
186
  }
204
187
 
205
- const text = arr.filter(_ => _).join('').trim()
188
+ const text = arr.filter(_ => _).join('')
206
189
 
207
190
  this.$emit('update:modelValue', text)
208
191
 
@@ -256,8 +239,8 @@ export default{
256
239
  @apply divide-y divide-text-100;
257
240
  }
258
241
 
259
- .comp p{
260
- @apply outline-none p-2 align-baseline;
242
+ .content{
243
+ @apply flex-1 whitespace-pre-line outline-none p-2;
261
244
  }
262
245
 
263
246
  .comp .tag{