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

@progress/kendo-editor-common

Package Overview
Dependencies
Maintainers
1
Versions
379
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@progress/kendo-editor-common - npm Package Compare versions

Comparing version

to
1.10.1-dev.202307241031

5

dist/es/config/schema.js

@@ -186,6 +186,3 @@ import { __assign } from "tslib";

group: 'block',
attrs: {
caption: { default: null },
style: { default: null }
},
attrs: __assign({ caption: { default: null } }, commonAttributes()),
parseDOM: [{

@@ -192,0 +189,0 @@ tag: 'div[caption]',

15

dist/es/plugins/table-resize/column-resize.js
import { __assign } from "tslib";
import { Plugin } from 'prosemirror-state';
import { tableNodeTypes, TableMap } from 'prosemirror-tables';
import { TableMap } from 'prosemirror-tables';
import { Decoration, DecorationSet } from 'prosemirror-view';
import { colgroupAttr } from '../../config/constants';
import { TableView } from './table-view';
import { TableView, TableWrapperView } from './table-view';
import { cellIndexes, domCellAround, otherResizeHandle, otherResizing, edgeCell, parseStyle, setNodeStyle, tableColumnResizeKey as key } from './utils';
export function columnResizing() {
// tslint:disable-next-line:variable-name
var View = TableView, handleWidth = 5, cellMinWidth = 25;
var handleWidth = 5, cellMinWidth = 25;
var plugin = new Plugin({
key: key,
state: {
init: function (_, state) {
this.spec.props.nodeViews[tableNodeTypes(state.schema).table.name] = function (node, view) { return new View(node, view); };
init: function (_, _state) {
return new ResizeState(-1, null);

@@ -54,3 +52,6 @@ },

},
nodeViews: {}
nodeViews: {
table_wrapper: function (node, view) { return new TableWrapperView(node, view); },
table: function (node, view) { return new TableView(node, view); }
}
}

@@ -57,0 +58,0 @@ });

@@ -31,2 +31,3 @@ import { __assign } from "tslib";

var handleMouseMove = function (view, event) {
var _a;
var state = key.getState(view.state);

@@ -56,2 +57,8 @@ var dragging = state.dragging, nodePosition = state.nodePosition, activeHandle = state.activeHandle;

}
if (/px/.test(tableDom.style.width)) {
var wrapper = (_a = tableDom.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode;
if (wrapper instanceof HTMLDivElement && wrapper.matches('div[table]') && /%/.test(wrapper.style.width)) {
wrapper.style.width = '';
}
}
};

@@ -157,2 +164,11 @@ var toPercents = function (view, tr, tablePos) {

});
if (!/%/.test(parseStyle(attrs.style).width || '')) {
var $pos = tr.doc.resolve(nodePosition);
var wrapper = parentNode($pos, function (n) { return n.type.name === 'table_wrapper'; });
if (wrapper && /%/.test(parseStyle(wrapper.node.attrs.style).width || '')) {
var wrapperAttrs = setNodeStyle(wrapper.node.attrs, 'width', '');
var wrapperPos = $pos.start(wrapper.depth) - 1;
tr.setNodeMarkup(wrapperPos, null, wrapperAttrs);
}
}
view.dispatch(tr);

@@ -159,0 +175,0 @@ }

@@ -84,2 +84,9 @@ import { colgroupAttr, dataResizeDirTable, resizableAttr, resizableWrap, resizeHandle } from '../../config/constants';

}
if (/%$/.test(table.style.width)) {
this.dom.style.width = table.style.width;
table.style.width = '';
}
else {
this.dom.style.width = '';
}
};

@@ -89,1 +96,48 @@ return TableView;

export { TableView };
var TableWrapperView = /** @class */ (function () {
function TableWrapperView(node, view) {
this.node = node;
this.view = view;
this.dom = document.createElement('div');
this.setAttributes(this.dom, node.attrs);
this.contentDOM = this.dom;
}
TableWrapperView.prototype.update = function (node) {
if (node.type !== this.node.type) {
return false;
}
this.node = node;
this.setAttributes(this.dom, node.attrs);
return true;
};
TableWrapperView.prototype.ignoreMutation = function (record) {
return record.type === 'attributes' && record.attributeName === 'style';
};
TableWrapperView.prototype.destroy = function () {
this.node = undefined;
this.view = undefined;
};
TableWrapperView.prototype.setAttributes = function (dom, attrs) {
for (var attrName in attrs) {
if (attrName) {
var current = dom.getAttribute(attrName);
var next = attrs[attrName];
if (next && next !== current) {
dom.setAttribute(attrName, next);
}
else if (!next) {
dom.removeAttribute(attrName);
}
}
}
dom.setAttribute('table', '');
if (/%/.test(dom.style.width)) {
var table = dom.querySelector('table');
if (table && table.style.width && !/%/.test(table.style.width)) {
dom.style.width = '';
}
}
};
return TableWrapperView;
}());
export { TableWrapperView };

@@ -31,12 +31,21 @@ import { DOMSerializer, DOMParser as ProseMirrorDOMParser } from 'prosemirror-model';

table.style.marginRight = wrapper.style.marginRight;
var captionDiv = Array.from(wrapper.children).find(function (el) { return el.matches('div[caption]'); });
if (captionDiv) {
var caption = table.createCaption();
caption.style.textAlign = captionDiv.style.textAlign;
caption.style.verticalAlign = captionDiv.style.verticalAlign;
caption.style.captionSide = captionDiv.style.captionSide;
while (captionDiv.firstChild) {
caption.appendChild(captionDiv.firstChild);
var captionDiv_1 = Array.from(wrapper.children).find(function (el) { return el.matches('div[caption]'); });
if (captionDiv_1 && captionDiv_1.innerHTML !== '<img>') {
var caption_1 = table.createCaption();
if (captionDiv_1.id) {
caption_1.id = captionDiv_1.id;
}
if (captionDiv_1.className) {
caption_1.className = captionDiv_1.className;
}
Array.from(captionDiv_1.style).forEach(function (styleName) {
caption_1.style[styleName] = captionDiv_1.style[styleName];
});
while (captionDiv_1.firstChild) {
caption_1.appendChild(captionDiv_1.firstChild);
}
}
if (wrapper.style.width && !table.style.width) {
table.style.width = wrapper.style.width;
}
wrapper.parentNode.insertBefore(table, wrapper);

@@ -79,16 +88,25 @@ wrapper.parentNode.removeChild(wrapper);

if (table.caption) {
var captionDiv = document.createElement('div');
captionDiv.setAttribute('caption', '');
captionDiv.style.display = 'table-caption';
captionDiv.style.textAlign = table.caption.style.textAlign;
captionDiv.style.verticalAlign = table.caption.style.verticalAlign;
captionDiv.style.captionSide = table.caption.style.captionSide;
var captionDiv_2 = document.createElement('div');
captionDiv_2.setAttribute('caption', '');
if (table.caption.id) {
captionDiv_2.id = table.caption.id;
}
if (table.caption.className) {
captionDiv_2.className = table.caption.className;
}
Array.from(table.caption.style).forEach(function (styleName) {
captionDiv_2.style[styleName] = table.caption.style[styleName];
});
while (table.caption.firstChild) {
captionDiv.appendChild(table.caption.firstChild);
captionDiv_2.appendChild(table.caption.firstChild);
}
table.removeChild(table.caption);
wrapper.appendChild(captionDiv);
wrapper.appendChild(captionDiv_2);
}
table.parentNode.insertBefore(wrapper, table);
wrapper.appendChild(table);
if (/%/.test(table.style.width)) {
wrapper.style.width = table.style.width;
table.style.width = '';
}
}

@@ -95,0 +113,0 @@ });

@@ -179,6 +179,3 @@ import { Schema } from 'prosemirror-model';

group: 'block',
attrs: {
caption: { default: null },
style: { default: null }
},
attrs: Object.assign({ caption: { default: null } }, commonAttributes()),
parseDOM: [{

@@ -185,0 +182,0 @@ tag: 'div[caption]',

import { Plugin } from 'prosemirror-state';
import { tableNodeTypes, TableMap } from 'prosemirror-tables';
import { TableMap } from 'prosemirror-tables';
import { Decoration, DecorationSet } from 'prosemirror-view';
import { colgroupAttr } from '../../config/constants';
import { TableView } from './table-view';
import { TableView, TableWrapperView } from './table-view';
import { cellIndexes, domCellAround, otherResizeHandle, otherResizing, edgeCell, parseStyle, setNodeStyle, tableColumnResizeKey as key } from './utils';
export function columnResizing() {
// tslint:disable-next-line:variable-name
const View = TableView, handleWidth = 5, cellMinWidth = 25;
const handleWidth = 5, cellMinWidth = 25;
let plugin = new Plugin({
key,
state: {
init(_, state) {
this.spec.props.nodeViews[tableNodeTypes(state.schema).table.name] = (node, view) => new View(node, view);
init(_, _state) {
return new ResizeState(-1, null);

@@ -53,3 +51,6 @@ },

},
nodeViews: {}
nodeViews: {
table_wrapper: (node, view) => new TableWrapperView(node, view),
table: (node, view) => new TableView(node, view)
}
}

@@ -56,0 +57,0 @@ });

@@ -29,2 +29,3 @@ import { NodeSelection, Plugin } from 'prosemirror-state';

const handleMouseMove = (view, event) => {
var _a;
const state = key.getState(view.state);

@@ -54,2 +55,8 @@ const { dragging, nodePosition, activeHandle } = state;

}
if (/px/.test(tableDom.style.width)) {
const wrapper = (_a = tableDom.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode;
if (wrapper instanceof HTMLDivElement && wrapper.matches('div[table]') && /%/.test(wrapper.style.width)) {
wrapper.style.width = '';
}
}
};

@@ -155,2 +162,11 @@ const toPercents = (view, tr, tablePos) => {

});
if (!/%/.test(parseStyle(attrs.style).width || '')) {
const $pos = tr.doc.resolve(nodePosition);
const wrapper = parentNode($pos, n => n.type.name === 'table_wrapper');
if (wrapper && /%/.test(parseStyle(wrapper.node.attrs.style).width || '')) {
const wrapperAttrs = setNodeStyle(wrapper.node.attrs, 'width', '');
const wrapperPos = $pos.start(wrapper.depth) - 1;
tr.setNodeMarkup(wrapperPos, null, wrapperAttrs);
}
}
view.dispatch(tr);

@@ -157,0 +173,0 @@ }

@@ -83,3 +83,55 @@ import { colgroupAttr, dataResizeDirTable, resizableAttr, resizableWrap, resizeHandle } from '../../config/constants';

}
if (/%$/.test(table.style.width)) {
this.dom.style.width = table.style.width;
table.style.width = '';
}
else {
this.dom.style.width = '';
}
}
}
export class TableWrapperView {
constructor(node, view) {
this.node = node;
this.view = view;
this.dom = document.createElement('div');
this.setAttributes(this.dom, node.attrs);
this.contentDOM = this.dom;
}
update(node) {
if (node.type !== this.node.type) {
return false;
}
this.node = node;
this.setAttributes(this.dom, node.attrs);
return true;
}
ignoreMutation(record) {
return record.type === 'attributes' && record.attributeName === 'style';
}
destroy() {
this.node = undefined;
this.view = undefined;
}
setAttributes(dom, attrs) {
for (let attrName in attrs) {
if (attrName) {
const current = dom.getAttribute(attrName);
const next = attrs[attrName];
if (next && next !== current) {
dom.setAttribute(attrName, next);
}
else if (!next) {
dom.removeAttribute(attrName);
}
}
}
dom.setAttribute('table', '');
if (/%/.test(dom.style.width)) {
const table = dom.querySelector('table');
if (table && table.style.width && !/%/.test(table.style.width)) {
dom.style.width = '';
}
}
}
}

@@ -32,7 +32,13 @@ import { DOMSerializer, DOMParser as ProseMirrorDOMParser } from 'prosemirror-model';

const captionDiv = Array.from(wrapper.children).find(el => el.matches('div[caption]'));
if (captionDiv) {
if (captionDiv && captionDiv.innerHTML !== '<img>') {
const caption = table.createCaption();
caption.style.textAlign = captionDiv.style.textAlign;
caption.style.verticalAlign = captionDiv.style.verticalAlign;
caption.style.captionSide = captionDiv.style.captionSide;
if (captionDiv.id) {
caption.id = captionDiv.id;
}
if (captionDiv.className) {
caption.className = captionDiv.className;
}
Array.from(captionDiv.style).forEach((styleName) => {
caption.style[styleName] = captionDiv.style[styleName];
});
while (captionDiv.firstChild) {

@@ -42,2 +48,5 @@ caption.appendChild(captionDiv.firstChild);

}
if (wrapper.style.width && !table.style.width) {
table.style.width = wrapper.style.width;
}
wrapper.parentNode.insertBefore(table, wrapper);

@@ -82,6 +91,11 @@ wrapper.parentNode.removeChild(wrapper);

captionDiv.setAttribute('caption', '');
captionDiv.style.display = 'table-caption';
captionDiv.style.textAlign = table.caption.style.textAlign;
captionDiv.style.verticalAlign = table.caption.style.verticalAlign;
captionDiv.style.captionSide = table.caption.style.captionSide;
if (table.caption.id) {
captionDiv.id = table.caption.id;
}
if (table.caption.className) {
captionDiv.className = table.caption.className;
}
Array.from(table.caption.style).forEach((styleName) => {
captionDiv.style[styleName] = table.caption.style[styleName];
});
while (table.caption.firstChild) {

@@ -95,2 +109,6 @@ captionDiv.appendChild(table.caption.firstChild);

wrapper.appendChild(table);
if (/%/.test(table.style.width)) {
wrapper.style.width = table.style.width;
table.style.width = '';
}
}

@@ -97,0 +115,0 @@ });

@@ -191,6 +191,3 @@ "use strict";

group: 'block',
attrs: {
caption: { default: null },
style: { default: null }
},
attrs: tslib_1.__assign({ caption: { default: null } }, commonAttributes()),
parseDOM: [{

@@ -197,0 +194,0 @@ tag: 'div[caption]',

@@ -12,9 +12,7 @@ "use strict";

function columnResizing() {
// tslint:disable-next-line:variable-name
var View = table_view_1.TableView, handleWidth = 5, cellMinWidth = 25;
var handleWidth = 5, cellMinWidth = 25;
var plugin = new prosemirror_state_1.Plugin({
key: utils_1.tableColumnResizeKey,
state: {
init: function (_, state) {
this.spec.props.nodeViews[prosemirror_tables_1.tableNodeTypes(state.schema).table.name] = function (node, view) { return new View(node, view); };
init: function (_, _state) {
return new ResizeState(-1, null);

@@ -58,3 +56,6 @@ },

},
nodeViews: {}
nodeViews: {
table_wrapper: function (node, view) { return new table_view_1.TableWrapperView(node, view); },
table: function (node, view) { return new table_view_1.TableView(node, view); }
}
}

@@ -61,0 +62,0 @@ });

@@ -34,2 +34,3 @@ "use strict";

var handleMouseMove = function (view, event) {
var _a;
var state = utils_1.tableResizeKey.getState(view.state);

@@ -59,2 +60,8 @@ var dragging = state.dragging, nodePosition = state.nodePosition, activeHandle = state.activeHandle;

}
if (/px/.test(tableDom.style.width)) {
var wrapper = (_a = tableDom.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode;
if (wrapper instanceof HTMLDivElement && wrapper.matches('div[table]') && /%/.test(wrapper.style.width)) {
wrapper.style.width = '';
}
}
};

@@ -160,2 +167,11 @@ var toPercents = function (view, tr, tablePos) {

});
if (!/%/.test(utils_1.parseStyle(attrs.style).width || '')) {
var $pos = tr.doc.resolve(nodePosition);
var wrapper = utils_1.parentNode($pos, function (n) { return n.type.name === 'table_wrapper'; });
if (wrapper && /%/.test(utils_1.parseStyle(wrapper.node.attrs.style).width || '')) {
var wrapperAttrs = utils_1.setNodeStyle(wrapper.node.attrs, 'width', '');
var wrapperPos = $pos.start(wrapper.depth) - 1;
tr.setNodeMarkup(wrapperPos, null, wrapperAttrs);
}
}
view.dispatch(tr);

@@ -162,0 +178,0 @@ }

import { Node } from 'prosemirror-model';
import { EditorView } from 'prosemirror-view';
export declare class TableView {
import { EditorView, NodeView } from 'prosemirror-view';
export declare class TableView implements NodeView {
node?: Node;

@@ -8,3 +8,3 @@ view?: EditorView;

colgroup?: HTMLTableColElement;
dom?: HTMLElement;
dom: HTMLElement;
contentDOM?: HTMLElement;

@@ -19,1 +19,12 @@ private resizeHandles?;

}
export declare class TableWrapperView implements NodeView {
node?: Node;
view?: EditorView;
dom: HTMLElement;
contentDOM?: HTMLElement;
constructor(node: Node, view: EditorView);
update(node: Node): boolean;
ignoreMutation(record: MutationRecord): boolean;
destroy(): void;
private setAttributes;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TableView = void 0;
exports.TableWrapperView = exports.TableView = void 0;
var constants_1 = require("../../config/constants");

@@ -87,2 +87,9 @@ var schema_1 = require("../../config/schema");

}
if (/%$/.test(table.style.width)) {
this.dom.style.width = table.style.width;
table.style.width = '';
}
else {
this.dom.style.width = '';
}
};

@@ -92,1 +99,48 @@ return TableView;

exports.TableView = TableView;
var TableWrapperView = /** @class */ (function () {
function TableWrapperView(node, view) {
this.node = node;
this.view = view;
this.dom = document.createElement('div');
this.setAttributes(this.dom, node.attrs);
this.contentDOM = this.dom;
}
TableWrapperView.prototype.update = function (node) {
if (node.type !== this.node.type) {
return false;
}
this.node = node;
this.setAttributes(this.dom, node.attrs);
return true;
};
TableWrapperView.prototype.ignoreMutation = function (record) {
return record.type === 'attributes' && record.attributeName === 'style';
};
TableWrapperView.prototype.destroy = function () {
this.node = undefined;
this.view = undefined;
};
TableWrapperView.prototype.setAttributes = function (dom, attrs) {
for (var attrName in attrs) {
if (attrName) {
var current = dom.getAttribute(attrName);
var next = attrs[attrName];
if (next && next !== current) {
dom.setAttribute(attrName, next);
}
else if (!next) {
dom.removeAttribute(attrName);
}
}
}
dom.setAttribute('table', '');
if (/%/.test(dom.style.width)) {
var table = dom.querySelector('table');
if (table && table.style.width && !/%/.test(table.style.width)) {
dom.style.width = '';
}
}
};
return TableWrapperView;
}());
exports.TableWrapperView = TableWrapperView;

@@ -34,12 +34,21 @@ "use strict";

table.style.marginRight = wrapper.style.marginRight;
var captionDiv = Array.from(wrapper.children).find(function (el) { return el.matches('div[caption]'); });
if (captionDiv) {
var caption = table.createCaption();
caption.style.textAlign = captionDiv.style.textAlign;
caption.style.verticalAlign = captionDiv.style.verticalAlign;
caption.style.captionSide = captionDiv.style.captionSide;
while (captionDiv.firstChild) {
caption.appendChild(captionDiv.firstChild);
var captionDiv_1 = Array.from(wrapper.children).find(function (el) { return el.matches('div[caption]'); });
if (captionDiv_1 && captionDiv_1.innerHTML !== '<img>') {
var caption_1 = table.createCaption();
if (captionDiv_1.id) {
caption_1.id = captionDiv_1.id;
}
if (captionDiv_1.className) {
caption_1.className = captionDiv_1.className;
}
Array.from(captionDiv_1.style).forEach(function (styleName) {
caption_1.style[styleName] = captionDiv_1.style[styleName];
});
while (captionDiv_1.firstChild) {
caption_1.appendChild(captionDiv_1.firstChild);
}
}
if (wrapper.style.width && !table.style.width) {
table.style.width = wrapper.style.width;
}
wrapper.parentNode.insertBefore(table, wrapper);

@@ -82,16 +91,25 @@ wrapper.parentNode.removeChild(wrapper);

if (table.caption) {
var captionDiv = document.createElement('div');
captionDiv.setAttribute('caption', '');
captionDiv.style.display = 'table-caption';
captionDiv.style.textAlign = table.caption.style.textAlign;
captionDiv.style.verticalAlign = table.caption.style.verticalAlign;
captionDiv.style.captionSide = table.caption.style.captionSide;
var captionDiv_2 = document.createElement('div');
captionDiv_2.setAttribute('caption', '');
if (table.caption.id) {
captionDiv_2.id = table.caption.id;
}
if (table.caption.className) {
captionDiv_2.className = table.caption.className;
}
Array.from(table.caption.style).forEach(function (styleName) {
captionDiv_2.style[styleName] = table.caption.style[styleName];
});
while (table.caption.firstChild) {
captionDiv.appendChild(table.caption.firstChild);
captionDiv_2.appendChild(table.caption.firstChild);
}
table.removeChild(table.caption);
wrapper.appendChild(captionDiv);
wrapper.appendChild(captionDiv_2);
}
table.parentNode.insertBefore(wrapper, table);
wrapper.appendChild(table);
if (/%/.test(table.style.width)) {
wrapper.style.width = table.style.width;
table.style.width = '';
}
}

@@ -98,0 +116,0 @@ });

{
"name": "@progress/kendo-editor-common",
"description": "Kendo UI TypeScript package exporting functions for Editor component",
"version": "1.10.1-dev.202307201821",
"version": "1.10.1-dev.202307241031",
"keywords": [

@@ -6,0 +6,0 @@ "Kendo UI"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display