quasar-ui-sellmate-ui-kit 3.2.21 → 3.3.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/index.common.js +2 -2
- package/dist/index.css +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.min.css +1 -1
- package/dist/index.rtl.css +1 -1
- package/dist/index.rtl.min.css +1 -1
- package/dist/index.umd.js +27 -36
- package/dist/index.umd.min.js +2 -2
- package/package.json +1 -1
- package/src/components/SEditor.vue +27 -36
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
v-model="value"
|
|
25
25
|
dense
|
|
26
26
|
outlined
|
|
27
|
-
:placeholder="
|
|
27
|
+
:placeholder="imgInputPlaceholder"
|
|
28
28
|
autogrow
|
|
29
29
|
autofocus
|
|
30
30
|
/>
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
45
|
<script>
|
|
46
|
-
import { defineComponent, ref, watch } from 'vue';
|
|
46
|
+
import { defineComponent, ref, watch, computed } from 'vue';
|
|
47
47
|
import { extend, QCard, QCardSection, QDialog, QEditor, QInput, useQuasar } from 'quasar';
|
|
48
48
|
|
|
49
49
|
export default defineComponent({
|
|
@@ -60,17 +60,15 @@
|
|
|
60
60
|
toolbar: {
|
|
61
61
|
type: Array,
|
|
62
62
|
validator: v => v.length === 0 || v.every(group => group.length),
|
|
63
|
-
default()
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
];
|
|
73
|
-
},
|
|
63
|
+
default: () => [
|
|
64
|
+
['left', 'center', 'right', 'justify'],
|
|
65
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
66
|
+
['link', 'hr'],
|
|
67
|
+
['fontSizes', 'removeFormat'],
|
|
68
|
+
['unordered', 'ordered', 'outdent', 'indent'],
|
|
69
|
+
['undo', 'redo'],
|
|
70
|
+
['viewsource'],
|
|
71
|
+
],
|
|
74
72
|
},
|
|
75
73
|
defaultFontSize: {
|
|
76
74
|
type: Number,
|
|
@@ -96,19 +94,15 @@
|
|
|
96
94
|
type: String,
|
|
97
95
|
required: true,
|
|
98
96
|
},
|
|
99
|
-
|
|
97
|
+
useImgUpload: {
|
|
100
98
|
type: Boolean,
|
|
101
|
-
default:
|
|
99
|
+
default: false,
|
|
102
100
|
},
|
|
103
101
|
imgInputPlaceholder: {
|
|
104
102
|
type: String,
|
|
105
103
|
default:
|
|
106
104
|
'이미지 파일 경로를 엔터키로 구분하여 여러개 입력할 수 있습니다.\n예시)\nhttps://www.sellmate.co.kr/img/new/logo01.png\nhttps://www.sellmate.co.kr/img/new/logo02.png\nhttps://www.sellmate.co.kr/img/new/logo03.png',
|
|
107
105
|
},
|
|
108
|
-
useListOpts: {
|
|
109
|
-
type: Boolean,
|
|
110
|
-
default: false,
|
|
111
|
-
},
|
|
112
106
|
usePlaintextPasting: {
|
|
113
107
|
type: Boolean,
|
|
114
108
|
default: false,
|
|
@@ -119,7 +113,6 @@
|
|
|
119
113
|
const $q = useQuasar();
|
|
120
114
|
|
|
121
115
|
// Toolbar Begin
|
|
122
|
-
const placeholder = ref(props.imgInputPlaceholder);
|
|
123
116
|
const isOpened = ref(false);
|
|
124
117
|
const value = ref('');
|
|
125
118
|
|
|
@@ -130,9 +123,9 @@
|
|
|
130
123
|
function setFontSize(fontSize) {
|
|
131
124
|
function isRootNode(node) {
|
|
132
125
|
return (
|
|
133
|
-
node.nodeType !== Node.TEXT_NODE
|
|
134
|
-
|
|
135
|
-
|
|
126
|
+
node.nodeType !== Node.TEXT_NODE &&
|
|
127
|
+
(node.className.indexOf('q-editor__content') >= 0 ||
|
|
128
|
+
node.hasAttribute('contenteditable'))
|
|
136
129
|
);
|
|
137
130
|
}
|
|
138
131
|
|
|
@@ -163,9 +156,9 @@
|
|
|
163
156
|
function getNonTextNode(top, node) {
|
|
164
157
|
const parent = node.parentNode;
|
|
165
158
|
if (
|
|
166
|
-
top !== parent
|
|
167
|
-
|
|
168
|
-
|
|
159
|
+
top !== parent &&
|
|
160
|
+
Array.from(parent.childNodes).length === 1 &&
|
|
161
|
+
parent.childNodes[0] === node
|
|
169
162
|
) {
|
|
170
163
|
return parent;
|
|
171
164
|
}
|
|
@@ -246,9 +239,8 @@
|
|
|
246
239
|
const wrapperNode = wrapAndReplaceRange(range);
|
|
247
240
|
wrapperNode.style.fontSize = fontSizeStyle;
|
|
248
241
|
} else {
|
|
249
|
-
const targetNode =
|
|
250
|
-
? wrapAndReplaceTextNodeRange(topNode)
|
|
251
|
-
: topNode;
|
|
242
|
+
const targetNode =
|
|
243
|
+
topNode.nodeType === Node.TEXT_NODE ? wrapAndReplaceTextNodeRange(topNode) : topNode;
|
|
252
244
|
targetNode.style.fontSize = fontSizeStyle;
|
|
253
245
|
selection.extend(targetNode.childNodes[0], targetNode.textContent.length);
|
|
254
246
|
}
|
|
@@ -273,9 +265,8 @@
|
|
|
273
265
|
// selection.extend(end, range.endOffset);
|
|
274
266
|
applyStyleForward(fontSizeStyle, topNode, startWrapper);
|
|
275
267
|
} else {
|
|
276
|
-
const firstNode =
|
|
277
|
-
? getNonTextNode(topNode, start)
|
|
278
|
-
: start;
|
|
268
|
+
const firstNode =
|
|
269
|
+
start.nodeType === Node.TEXT_NODE ? getNonTextNode(topNode, start) : start;
|
|
279
270
|
firstNode.style.fontSize = fontSizeStyle;
|
|
280
271
|
if (start !== startNode) applyStyleForward(fontSizeStyle, topNode, firstNode);
|
|
281
272
|
}
|
|
@@ -400,8 +391,6 @@
|
|
|
400
391
|
options: ['size1', 'size2', 'size3', 'size4', 'size5', 'size6'],
|
|
401
392
|
};
|
|
402
393
|
|
|
403
|
-
const toolbarDefinitions = props.toolbar.map(group => group.map(item => (item === 'fontSizes' ? fontSizes : item)));
|
|
404
|
-
|
|
405
394
|
function onOkClick() {
|
|
406
395
|
value.value.split('\n').forEach((el, idx) => {
|
|
407
396
|
if (el === '') return;
|
|
@@ -451,12 +440,14 @@
|
|
|
451
440
|
}
|
|
452
441
|
|
|
453
442
|
return {
|
|
454
|
-
toolbarDefinitions
|
|
443
|
+
toolbarDefinitions: computed(() => {
|
|
444
|
+
const bar = props.useImgUpload ? [...props.toolbar, ['upload']] : props.toolbar;
|
|
445
|
+
return bar.map(group => group.map(item => (item === 'fontSizes' ? fontSizes : item)));
|
|
446
|
+
}),
|
|
455
447
|
toolDefinitions,
|
|
456
448
|
isOpened,
|
|
457
449
|
model,
|
|
458
450
|
value,
|
|
459
|
-
placeholder,
|
|
460
451
|
uploadImage,
|
|
461
452
|
onOkClick,
|
|
462
453
|
onPaste,
|