New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@paroicms/quill-editor-plugin

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paroicms/quill-editor-plugin - npm Package Compare versions

Comparing version 1.24.0 to 1.25.0

33

backend/dist/plugin.js

@@ -1,25 +0,24 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
const public_server_lib_1 = require("@paroicms/public-server-lib");
const node_path_1 = require("node:path");
const quill_delta_1 = require("./quill-delta");
const projectDir = (0, node_path_1.dirname)(__dirname);
const packageDir = (0, node_path_1.dirname)(projectDir);
const version = (0, data_formatters_lib_1.strVal)(require((0, node_path_1.join)(packageDir, "package.json")).version);
import { isObj, strVal } from "@paroi/data-formatters-lib";
import { escapeHtml, resolveModuleDirectory, } from "@paroicms/public-server-lib";
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { convertQuillDeltaToHtml, convertQuillDeltaToPlainText } from "./quill-delta.js";
const projectDir = resolveModuleDirectory(import.meta.url, { parent: true });
const packageDir = dirname(projectDir);
const version = strVal(JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8")).version);
const plugin = {
version,
siteInit(service) {
service.setPublicAssetsDirectory((0, node_path_1.join)(packageDir, "public-front", "dist"));
service.setBoAssetsDirectory((0, node_path_1.join)(packageDir, "bo-front", "dist"));
service.registerSiteSchemaLibrary((0, node_path_1.join)(packageDir, "site-schema-lib"));
service.setPublicAssetsDirectory(join(packageDir, "public-front", "dist"));
service.setBoAssetsDirectory(join(packageDir, "bo-front", "dist"));
service.registerSiteSchemaLibrary(join(packageDir, "site-schema-lib"));
service.registerFieldPreprocessor("quillDelta", (service, value, options) => {
if (!(0, data_formatters_lib_1.isObj)(value) || !(0, data_formatters_lib_1.isObj)(value.delta))
if (!isObj(value) || !isObj(value.delta))
return;
const delta = value.delta;
if (options.outputType === "plainText")
return (0, quill_delta_1.convertQuillDeltaToPlainText)(service, delta);
return (0, quill_delta_1.convertQuillDeltaToHtml)(service, delta, options);
return convertQuillDeltaToPlainText(service, delta);
return convertQuillDeltaToHtml(service, delta, options);
});
service.addHeadTag(`<link rel="stylesheet" href="${(0, public_server_lib_1.escapeHtml)(`${service.pluginAssetsUrl}/public-front-plugin.css`)}">`, `<script type="module" src="${(0, public_server_lib_1.escapeHtml)(`${service.pluginAssetsUrl}/public-front-plugin.mjs`)}"></script>`);
service.addHeadTag(`<link rel="stylesheet" href="${escapeHtml(`${service.pluginAssetsUrl}/public-front-plugin.css`)}">`, `<script type="module" src="${escapeHtml(`${service.pluginAssetsUrl}/public-front-plugin.mjs`)}"></script>`);
if (service.pluginConf.backOffice?.code) {

@@ -39,2 +38,2 @@ service.addHeadTag(`<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.10.0/build/styles/default.min.css">`, `<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.10.0/build/highlight.min.js"></script>`, `<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.10.0/build/languages/typescript.min.js"></script>`, `<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.10.0/build/languages/javascript.min.js"></script>`, `<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.10.0/build/languages/xml.min.js"></script>`, `<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.10.0/build/languages/json.min.js"></script>`, `<script>

};
exports.default = plugin;
export default plugin;

@@ -1,12 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertQuillDeltaToHtml = convertQuillDeltaToHtml;
exports.convertQuillDeltaToPlainText = convertQuillDeltaToPlainText;
const data_formatters_lib_1 = require("@paroi/data-formatters-lib");
const quill_delta_to_html_1 = require("@paroi/quill-delta-to-html");
const public_server_lib_1 = require("@paroicms/public-server-lib");
async function convertQuillDeltaToHtml(service, delta, options) {
import { nbValOrUndef, strVal, strValOrUndef } from "@paroi/data-formatters-lib";
import { QuillDeltaToHtmlAsyncConverter, QuillDeltaToHtmlConverter, } from "@paroi/quill-delta-to-html";
import { applyRatioToImageSize, escapeHtml, generateObfuscatedHtml, isImageSize, obfuscateAsHtmlLink, stripHtmlTags, toAbsoluteUrl, } from "@paroicms/public-server-lib";
export async function convertQuillDeltaToHtml(service, delta, options) {
const ops = delta.ops;
preprocessDelta(ops);
const converter = new quill_delta_to_html_1.QuillDeltaToHtmlAsyncConverter(ops, {
const converter = new QuillDeltaToHtmlAsyncConverter(ops, {
multiLineParagraph: false,

@@ -44,4 +40,4 @@ linkTarget: (href) => {

}
function convertQuillDeltaToPlainText(service, delta) {
const converter = new quill_delta_to_html_1.QuillDeltaToHtmlConverter(delta.ops);
export function convertQuillDeltaToPlainText(service, delta) {
const converter = new QuillDeltaToHtmlConverter(delta.ops);
converter.renderCustomWith((customOp) => {

@@ -61,15 +57,15 @@ const { type, value } = customOp.insert;

const html = converter.convert();
return (0, public_server_lib_1.stripHtmlTags)(html, { blockSeparator: " – " });
return stripHtmlTags(html, { blockSeparator: " – " });
}
async function imgBlotProcessing(service, value, options) {
const { themeConf, useImage, logger } = service;
const uid = (0, data_formatters_lib_1.strValOrUndef)(value.uid, { varName: "uid" });
const variant = (0, data_formatters_lib_1.strValOrUndef)(value.variant, { varName: "variant" });
const align = (0, data_formatters_lib_1.strValOrUndef)(value.align);
const zoom = (0, data_formatters_lib_1.strValOrUndef)(value.zoom);
const uid = strValOrUndef(value.uid, { varName: "uid" });
const variant = strValOrUndef(value.variant, { varName: "variant" });
const align = strValOrUndef(value.align);
const zoom = strValOrUndef(value.zoom);
const hasZoom = zoom !== "none";
const href = (0, data_formatters_lib_1.strValOrUndef)(value.href, { varName: "href" });
const href = strValOrUndef(value.href, { varName: "href" });
let imgAttributes;
if (uid && variant && (0, public_server_lib_1.isImageSize)(variant)) {
const realSize = (0, public_server_lib_1.applyRatioToImageSize)(variant, themeConf.pixelRatio);
if (uid && variant && isImageSize(variant)) {
const realSize = applyRatioToImageSize(variant, themeConf.pixelRatio);
const image = await useImage({ size: realSize, imageUid: uid });

@@ -80,9 +76,9 @@ let dataZoomSrc;

imageUid: uid,
size: (0, public_server_lib_1.applyRatioToImageSize)("x1900x", themeConf.pixelRatio),
size: applyRatioToImageSize("x1900x", themeConf.pixelRatio),
});
dataZoomSrc = options?.absoluteUrls ? (0, public_server_lib_1.toAbsoluteUrl)(service, zoomImage.url) : zoomImage.url;
dataZoomSrc = options?.absoluteUrls ? toAbsoluteUrl(service, zoomImage.url) : zoomImage.url;
}
imgAttributes = {
dataZoomSrc,
src: options?.absoluteUrls ? (0, public_server_lib_1.toAbsoluteUrl)(service, image.url) : image.url,
src: options?.absoluteUrls ? toAbsoluteUrl(service, image.url) : image.url,
width: Math.round(image.width / themeConf.pixelRatio),

@@ -94,3 +90,3 @@ height: Math.round(image.height / themeConf.pixelRatio),

else {
const src = (0, data_formatters_lib_1.strValOrUndef)(value.src, { varName: "src" });
const src = strValOrUndef(value.src, { varName: "src" });
if (!src) {

@@ -103,4 +99,4 @@ logger.warn("missing 'uid' and 'src' in 'img' blot");

src,
width: (0, data_formatters_lib_1.nbValOrUndef)(value.width),
height: (0, data_formatters_lib_1.nbValOrUndef)(value.height),
width: nbValOrUndef(value.width),
height: nbValOrUndef(value.height),
href,

@@ -111,6 +107,6 @@ };

if (imgAttributes.dataZoomSrc) {
attributes.push(`data-zoom-src="${(0, public_server_lib_1.escapeHtml)(imgAttributes.dataZoomSrc)}"`);
attributes.push(`data-zoom-src="${escapeHtml(imgAttributes.dataZoomSrc)}"`);
}
attributes.push(`src="${(0, public_server_lib_1.escapeHtml)(imgAttributes.src)}"`);
attributes.push(`class="Img${align ? ` ${(0, public_server_lib_1.escapeHtml)(align)}` : ""}"`);
attributes.push(`src="${escapeHtml(imgAttributes.src)}"`);
attributes.push(`class="Img${align ? ` ${escapeHtml(align)}` : ""}"`);
attributes.push(`loading="lazy"`);

@@ -141,12 +137,12 @@ attributes.push(`width="${imgAttributes.width}"`);

function obfuscateBlotProcessing(value, inlineAttributes) {
const textVal = (0, data_formatters_lib_1.strValOrUndef)(value);
const textVal = strValOrUndef(value);
if (!textVal)
return "";
const asALink = formatObfuscateAsALink((0, data_formatters_lib_1.strVal)(inlineAttributes.obfuscate));
const asALink = formatObfuscateAsALink(strVal(inlineAttributes.obfuscate));
let obfuscatedVal;
if (asALink === "mailto" || asALink === "tel") {
obfuscatedVal = (0, public_server_lib_1.obfuscateAsHtmlLink)(textVal);
obfuscatedVal = obfuscateAsHtmlLink(textVal);
}
else {
obfuscatedVal = (0, public_server_lib_1.generateObfuscatedHtml)(textVal);
obfuscatedVal = generateObfuscatedHtml(textVal);
}

@@ -175,3 +171,3 @@ let result = obfuscatedVal;

function videoPluginBlotProcessing(_service, value, _options) {
const videoId = (0, data_formatters_lib_1.strValOrUndef)(value);
const videoId = strValOrUndef(value);
if (!videoId)

@@ -188,3 +184,3 @@ return "";

async function internalLinkPluginBlotProcessing(service, value, options) {
const documentId = (0, data_formatters_lib_1.strValOrUndef)(value);
const documentId = strValOrUndef(value);
if (!documentId)

@@ -196,3 +192,3 @@ return "";

const url = await doc.getUrl({ absoluteUrl: !!options?.absoluteUrls });
return `<a class="InternalLink" href="${url}">${(0, data_formatters_lib_1.strValOrUndef)(doc.title)}</a>`;
return `<a class="InternalLink" href="${url}">${strValOrUndef(doc.title)}</a>`;
}
{
"name": "@paroicms/quill-editor-plugin",
"version": "1.24.0",
"version": "1.25.0",
"description": "Quill Editor plugin for ParoiCMS",

@@ -40,5 +40,5 @@ "keywords": [

"devDependencies": {
"@paroicms/public-anywhere-lib": "0.14.0",
"@paroicms/public-bo-lib": "0.19.0",
"@paroicms/public-server-lib": "0.22.1",
"@paroicms/public-anywhere-lib": "0.15.0",
"@paroicms/public-bo-lib": "0.19.1",
"@paroicms/public-server-lib": "0.23.0",
"@solid-primitives/i18n": "~2.1.1",

@@ -58,2 +58,3 @@ "@types/node": "~22.10.7",

},
"type": "module",
"main": "backend/dist/plugin.js",

@@ -60,0 +61,0 @@ "types": "types/html-editor-public-types.d.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc