cinqcinqdev-seo 0.1.64 → 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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.1.64",
7
+ "version": "0.1.65",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "unknown"
@@ -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 || sel.rangeCount === 0 || sel.isCollapsed) return;
348
- const range = sel.getRangeAt(0);
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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cinqcinqdev-seo",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
4
4
  "description": "A reusable Nuxt 3 admin CMS module with visual page editor powered by Supabase",
5
5
  "license": "MIT",
6
6
  "module": "./dist/module.mjs",