cinqcinqdev-seo 0.1.63 → 0.1.65
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/module.json
CHANGED
|
@@ -342,10 +342,25 @@ const fileInput = ref(null);
|
|
|
342
342
|
let activeUploadTarget = null;
|
|
343
343
|
const execRteCmd = (cmd, val) => document.execCommand(cmd, false, val);
|
|
344
344
|
const rteFontSizePx = ref(16);
|
|
345
|
+
let savedRteRange = null;
|
|
346
|
+
const saveRteSelection = () => {
|
|
347
|
+
const sel = window.getSelection();
|
|
348
|
+
if (sel && sel.rangeCount > 0 && !sel.isCollapsed) {
|
|
349
|
+
savedRteRange = sel.getRangeAt(0).cloneRange();
|
|
350
|
+
}
|
|
351
|
+
};
|
|
345
352
|
const execRteFontSizePx = (px) => {
|
|
346
353
|
const sel = window.getSelection();
|
|
347
|
-
if (!sel
|
|
348
|
-
|
|
354
|
+
if (!sel) return;
|
|
355
|
+
let range = null;
|
|
356
|
+
if (sel.rangeCount > 0 && !sel.isCollapsed) {
|
|
357
|
+
range = sel.getRangeAt(0);
|
|
358
|
+
} else if (savedRteRange) {
|
|
359
|
+
sel.removeAllRanges();
|
|
360
|
+
sel.addRange(savedRteRange);
|
|
361
|
+
range = savedRteRange;
|
|
362
|
+
}
|
|
363
|
+
if (!range) return;
|
|
349
364
|
const frag = range.extractContents();
|
|
350
365
|
const span = document.createElement("span");
|
|
351
366
|
span.style.fontSize = px + "px";
|
|
@@ -355,6 +370,7 @@ const execRteFontSizePx = (px) => {
|
|
|
355
370
|
const newRange = document.createRange();
|
|
356
371
|
newRange.selectNodeContents(span);
|
|
357
372
|
sel.addRange(newRange);
|
|
373
|
+
savedRteRange = null;
|
|
358
374
|
};
|
|
359
375
|
const insertRteLink = () => {
|
|
360
376
|
const url = prompt("URL:");
|
|
@@ -841,6 +857,7 @@ const savePage = async () => {
|
|
|
841
857
|
v-html="getRteProp(page.content[selectedBlockIndex].props, name)"
|
|
842
858
|
@blur="setRteProp(page.content[selectedBlockIndex].props, name, $event.target.innerHTML);
|
|
843
859
|
trigger()"
|
|
860
|
+
@mouseup="saveRteSelection" @keyup="saveRteSelection"
|
|
844
861
|
:style="{ fontFamily: adminSettings.settings.value?.font_body || 'inherit' }"
|
|
845
862
|
class="w-full min-h-[140px] bg-gray-50 rounded-xl p-3 text-[11px] text-gray-800 leading-relaxed outline-none ring-1 ring-gray-100 focus:ring-[#3d35ff] overflow-auto rte-field"
|
|
846
863
|
></div>
|