@paroicms/quill-editor-plugin 1.45.0 → 1.45.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.
@@ -24,9 +24,9 @@ export async function convertQuillDeltaToHtml(service, delta, options) {
24
24
  return obfuscateBlotProcessing(value, customOp.attributes);
25
25
  if (type === "media")
26
26
  return await mediaBlotProcessing(service, value, options);
27
- if (type === "video-plugin")
28
- return videoPluginBlotProcessing(service, value, options);
29
- if (type === "internal-link-plugin") {
27
+ if (type === "platform-video")
28
+ return platformVideoBlotProcessing(service, value, options);
29
+ if (type === "internal-link") {
30
30
  return await internalLinkPluginBlotProcessing(service, value, options);
31
31
  }
32
32
  pluginService.logger.warn(`Invalid blot '${type}'`);
@@ -44,9 +44,9 @@ export function convertQuillDeltaToPlainText(service, delta) {
44
44
  return "";
45
45
  if (type === "media")
46
46
  return "";
47
- if (type === "video-plugin")
47
+ if (type === "platform-video")
48
48
  return "";
49
- if (type === "internal-link-plugin")
49
+ if (type === "internal-link")
50
50
  return "";
51
51
  service.pluginService.logger.warn(`Invalid blot '${type}'`);
52
52
  return "";
@@ -99,9 +99,9 @@ export function preprocessDelta(ops) {
99
99
  obfuscate: op.insert,
100
100
  };
101
101
  }
102
- else if (op.attributes?.["internal-link-plugin"]) {
102
+ else if (op.attributes?.["internal-link"]) {
103
103
  op.insert = {
104
- "internal-link-plugin": op.attributes?.["internal-link-plugin"],
104
+ "internal-link": op.attributes?.["internal-link"],
105
105
  };
106
106
  }
107
107
  }
@@ -140,15 +140,22 @@ function formatObfuscateAsALink(val) {
140
140
  return "tel";
141
141
  throw new Error(`invalid link-type '${val}'`);
142
142
  }
143
- function videoPluginBlotProcessing(_service, value, _options) {
144
- const videoId = StringOrUndefinedAT.assert(value);
145
- if (!videoId)
143
+ const PlatformVideoValueAT = type({
144
+ videoId: "string",
145
+ platform: "string",
146
+ "+": "reject",
147
+ });
148
+ function platformVideoBlotProcessing(service, value, _options) {
149
+ const videoValue = PlatformVideoValueAT.assert(value);
150
+ if (videoValue.platform !== "youtube") {
151
+ service.pluginService.logger.warn(`Unsupported video platform "${videoValue.platform}"`);
146
152
  return "";
153
+ }
147
154
  return `
148
155
  <iframe
149
156
  width="420"
150
157
  height="315"
151
- src="https://www.youtube.com/embed/${encodeURIComponent(videoId)}"
158
+ src="https://www.youtube-nocookie.com/embed/${encodeURIComponent(videoValue.videoId)}"
152
159
  ></iframe>
153
160
  `;
154
161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/quill-editor-plugin",
3
- "version": "1.45.0",
3
+ "version": "1.45.1",
4
4
  "description": "Quill Editor plugin for ParoiCMS",
5
5
  "keywords": [
6
6
  "paroicms",
@@ -29,20 +29,20 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@paroi/quill-delta-to-html": "~0.12.3",
32
- "@paroicms/script-lib": "0.3.2",
33
- "arktype": "~2.1.20"
32
+ "@paroicms/script-lib": "0.3.3",
33
+ "arktype": "~2.1.23"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@paroicms/public-anywhere-lib": "0",
37
37
  "@paroicms/public-server-lib": "0"
38
38
  },
39
39
  "devDependencies": {
40
- "@paroicms/public-anywhere-lib": "0.37.0",
41
- "@paroicms/public-server-lib": "0.47.0",
42
- "@types/node": "~24.0.1",
40
+ "@paroicms/public-anywhere-lib": "0.37.1",
41
+ "@paroicms/public-server-lib": "0.47.1",
42
+ "@types/node": "~24.8.1",
43
43
  "rimraf": "~6.0.1",
44
- "sass": "~1.89.2",
45
- "typescript": "~5.9.2"
44
+ "sass": "~1.93.2",
45
+ "typescript": "~5.9.3"
46
46
  },
47
47
  "type": "module",
48
48
  "main": "backend/dist/index.js",
@@ -52,6 +52,6 @@
52
52
  "admin-ui-plugin/dist",
53
53
  "public-assets/dist",
54
54
  "site-schema-lib",
55
- "types"
55
+ "types/html-editor-public-types.d.ts"
56
56
  ]
57
57
  }
@@ -1 +1 @@
1
- .Text .Fig{display:table;margin:0}.Text .Fig.left{float:left;margin:5px 20px 10px 0}.Text .Fig.right{float:right;margin:5px 0 10px 20px}.Text .Fig.center{clear:both;margin:20px auto}.Text .Fig-media{display:block;height:auto;max-width:100%}.Text .Fig-caption{caption-side:bottom;display:table-caption;font-size:.875em;margin-top:8px;opacity:.6;text-align:center}.Text .ql-align-center{text-align:center}.Text .ql-align-right{text-align:right}.Text .ql-size-small{font-size:.5625em}.Text .ql-size-large{font-size:1.125em}.Text .ql-size-huge{font-size:2em}
1
+ .Text .Fig{display:table;margin:0}.Text .Fig.left{float:left;margin:5px 20px 10px 0}.Text .Fig.right{float:right;margin:5px 0 10px 20px}.Text .Fig.center{clear:both;margin:20px auto}.Text .Fig-media{display:block;height:auto;max-width:100%}.Text .Fig-caption{caption-side:bottom;display:table-caption;font-size:.875em;margin-top:8px;opacity:.6;text-align:center}.Text .ql-align-center{text-align:center}.Text .ql-align-right{text-align:right}.Text .ql-size-small{font-size:.5625em}.Text .ql-size-large{font-size:2em}.Text .ql-size-huge{font-size:4em}
@@ -1,16 +1,21 @@
1
+ export interface PlatformVideoValue {
2
+ videoId: string;
3
+ platform: string;
4
+ }
5
+
1
6
  export interface HtmlEditorInitService {
2
7
  registerVideoPlugin(plugin: HtmlEditorVideoPlugin): void;
3
8
  registerInternalLinkPlugin(plugin: HtmlEditorInternalLinkPlugin): void;
4
9
  }
5
10
 
6
11
  export interface HtmlEditorVideoPlugin {
7
- recognizeUrl(url: string): boolean;
8
- getThumbnailUrl(videoId: string): string;
12
+ recognizeUrl(url: string): PlatformVideoValue | undefined;
13
+ getThumbnailUrl(value: PlatformVideoValue): string;
9
14
  createComponent(
10
- urlOrId: string,
15
+ value: PlatformVideoValue,
11
16
  options: {
12
17
  getLanguage: () => string;
13
- onChange: (newVal: string) => void;
18
+ onChange: (newVal: PlatformVideoValue | null) => void;
14
19
  },
15
20
  ): {
16
21
  element: HTMLElement;