@paroicms/quill-editor-plugin 1.40.0 → 1.41.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.
@@ -1,7 +1,7 @@
1
1
  import { isJsonFieldValue, isObj } from "@paroicms/public-anywhere-lib";
2
- import { escapeHtml, makeStylesheetLinkAsyncTag, resolveModuleDirectory, } from "@paroicms/public-server-lib";
2
+ import { escapeHtml, makeStylesheetLinkAsyncTag, } from "@paroicms/public-server-lib";
3
+ import { esmDirName, extractPackageNameAndVersionSync } from "@paroicms/script-lib";
3
4
  import { type } from "arktype";
4
- import { readFileSync } from "node:fs";
5
5
  import { dirname, join } from "node:path";
6
6
  import { normalizeTypographyInQuillDelta } from "./normalize-typography-in-delta.js";
7
7
  import { convertQuillDeltaToHtml, convertQuillDeltaToPlainText } from "./quill-delta.js";
@@ -9,16 +9,11 @@ const MediaIdQueryAT = type({
9
9
  "mediaId?": "string|undefined",
10
10
  "+": "reject",
11
11
  });
12
- const projectDir = resolveModuleDirectory(import.meta.url, { parent: true });
12
+ const projectDir = dirname(esmDirName(import.meta.url));
13
13
  const packageDir = dirname(projectDir);
14
- const { name: pluginName, version } = type({
15
- name: "string",
16
- version: "string",
17
- "+": "ignore",
18
- }).assert(JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8")));
14
+ const { name: pluginName, version } = extractPackageNameAndVersionSync(packageDir);
19
15
  const plugin = {
20
16
  version,
21
- slug: "quill-editor",
22
17
  siteInit(service) {
23
18
  service.setPublicAssetsDirectory(join(packageDir, "frontend", "dist"));
24
19
  service.setAdminUiAssetsDirectory(join(packageDir, "admin-ui-plugin", "dist"));
@@ -1 +1 @@
1
- import{delegateEvents as $,template as w,setAttribute as c,effect as Z}from"https://esm.sh/solid-js@1.9.7/web";function k(o){let e=o;const t=e.indexOf("?");t!==-1&&(e=e.substring(0,t));const r=e.indexOf("#");r!==-1&&(e=e.substring(0,r));const n=e.lastIndexOf("/");return n===-1?void 0:e.slice(0,n)}const g=k(import.meta.url);var E=w('<div class=PaZoomableViewer><button type=button class="PaZoomableViewer-closeButton PaButton"><img alt=⨯ width=30 height=30></button><div class=PaZoomableViewer-spinner>'),V=w('<div class=PaZoomableViewer><button type=button class="PaZoomableViewer-closeButton PaButton"><img alt=⨯ width=30 height=30></button><img class=PaZoomableViewer-img alt>');function x(){const o=document.querySelectorAll("[data-zoomable]");for(const e of o){if(!(e instanceof HTMLElement))continue;const t=e.dataset.zoomable?.trim();t&&P(e,{mediaId:t})}}function P(o,{mediaId:e}){o.classList.add("PaZoomable"),o.setAttribute("tabindex","0"),o.addEventListener("click",(async t=>{t.preventDefault(),await C(e)}))}async function C(o){const e=document.body,t=(()=>{var i=E(),s=i.firstChild,l=s.firstChild;return s.$$click=n,c(l,"src",`${g}/cross.svg`),i})();function r(i){i.key==="Escape"&&n()}function n(){t.remove(),e.removeEventListener("keyup",r)}e.addEventListener("keyup",r),e.appendChild(t);try{let i=function(d){d.key==="Escape"&&s()},s=function(){h.remove(),e.removeEventListener("keyup",i)};const l=await fetch(`/api/plugin/quill-editor/zoom-image?mediaId=${encodeURIComponent(o)}`);if(!l.ok){console.error("Failed to fetch zoom image:",l.statusText),n();return}const m=await l.json();n();const h=(()=>{var d=V(),u=d.firstChild,y=u.firstChild,f=u.nextSibling;return u.$$click=s,c(y,"src",`${g}/cross.svg`),Z((a=>{var v=m.url,p=m.width,b=m.height;return v!==a.e&&c(f,"src",a.e=v),p!==a.t&&c(f,"width",a.t=p),b!==a.a&&c(f,"height",a.a=b),a}),{e:void 0,t:void 0,a:void 0}),d})();e.addEventListener("keyup",i),e.appendChild(h)}catch(i){console.error("Error fetching zoom image:",i),n()}}$(["click"]);x();
1
+ import{delegateEvents as $,template as w,setAttribute as c,effect as Z}from"https://esm.sh/solid-js@1.9.7/web";function k(o){let e=o;const t=e.indexOf("?");t!==-1&&(e=e.substring(0,t));const r=e.indexOf("#");r!==-1&&(e=e.substring(0,r));const n=e.lastIndexOf("/");return n===-1?void 0:e.slice(0,n)}const b=k(import.meta.url),E="/api/plugin/quill-editor-plugin",P=E;var V=w('<div class=PaZoomableViewer><button type=button class="PaZoomableViewer-closeButton PaButton"><img alt=⨯ width=30 height=30></button><div class=PaZoomableViewer-spinner>'),x=w('<div class=PaZoomableViewer><button type=button class="PaZoomableViewer-closeButton PaButton"><img alt=⨯ width=30 height=30></button><img class=PaZoomableViewer-img alt>');function L(){const o=document.querySelectorAll("[data-zoomable]");for(const e of o){if(!(e instanceof HTMLElement))continue;const t=e.dataset.zoomable?.trim();t&&C(e,{mediaId:t})}}function C(o,{mediaId:e}){o.classList.add("PaZoomable"),o.setAttribute("tabindex","0"),o.addEventListener("click",(async t=>{t.preventDefault(),await _(e)}))}async function _(o){const e=document.body,t=(()=>{var i=V(),s=i.firstChild,l=s.firstChild;return s.$$click=n,c(l,"src",`${b}/cross.svg`),i})();function r(i){i.key==="Escape"&&n()}function n(){t.remove(),e.removeEventListener("keyup",r)}e.addEventListener("keyup",r),e.appendChild(t);try{let i=function(d){d.key==="Escape"&&s()},s=function(){p.remove(),e.removeEventListener("keyup",i)};const l=await fetch(`${P}/zoom-image?mediaId=${encodeURIComponent(o)}`);if(!l.ok){console.error("Failed to fetch zoom image:",l.statusText),n();return}const m=await l.json();n();const p=(()=>{var d=x(),u=d.firstChild,y=u.firstChild,f=u.nextSibling;return u.$$click=s,c(y,"src",`${b}/cross.svg`),Z((a=>{var h=m.url,v=m.width,g=m.height;return h!==a.e&&c(f,"src",a.e=h),v!==a.t&&c(f,"width",a.t=v),g!==a.a&&c(f,"height",a.a=g),a}),{e:void 0,t:void 0,a:void 0}),d})();e.addEventListener("keyup",i),e.appendChild(p)}catch(i){console.error("Error fetching zoom image:",i),n()}}$(["click"]);L();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/quill-editor-plugin",
3
- "version": "1.40.0",
3
+ "version": "1.41.1",
4
4
  "description": "Quill Editor plugin for ParoiCMS",
5
5
  "keywords": [
6
6
  "paroicms",
@@ -28,6 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@paroi/quill-delta-to-html": "~0.12.3",
31
+ "@paroicms/script-lib": "0.2.1",
31
32
  "arktype": "~2.1.20"
32
33
  },
33
34
  "peerDependencies": {
@@ -35,14 +36,14 @@
35
36
  "@paroicms/public-server-lib": "0"
36
37
  },
37
38
  "devDependencies": {
38
- "@paroicms/public-anywhere-lib": "0.33.0",
39
- "@paroicms/public-server-lib": "0.42.0",
39
+ "@paroicms/public-anywhere-lib": "0.35.0",
40
+ "@paroicms/public-server-lib": "0.45.0",
40
41
  "@types/node": "~24.0.1",
41
42
  "rimraf": "~6.0.1",
42
43
  "typescript": "~5.8.3"
43
44
  },
44
45
  "type": "module",
45
- "main": "backend/dist/plugin.js",
46
+ "main": "backend/dist/index.js",
46
47
  "types": "types/html-editor-public-types.d.ts",
47
48
  "files": [
48
49
  "backend/dist",