@progress/kendo-editor-common
Advanced tools
Comparing version 1.11.1 to 1.11.2-dev.202402200937
@@ -34,3 +34,3 @@ import { blockNodes, addStyles, changeTextBlock } from './blockNode'; | ||
result = action.style.every(function (style) { | ||
return !!style.value && new RegExp(style.name + ":\\s?" + style.value, 'i').test(node.attrs.style); | ||
return !!style.value && new RegExp("".concat(style.name, ":\\s?").concat(style.value), 'i').test(node.attrs.style); | ||
}); | ||
@@ -37,0 +37,0 @@ } |
@@ -74,3 +74,3 @@ import { __assign, __rest } from "tslib"; | ||
var to = range.$to.pos; | ||
doc.nodesBetween(from, to, function (node, pos, _parent, _index) { | ||
doc.nodesBetween(from, to, function (node, pos) { | ||
if (node.isBlock && (!blocksInSelection || (pos >= from && pos + node.content.size + 2 <= to))) { | ||
@@ -94,4 +94,3 @@ result.push(node); | ||
if (value === 'p') { | ||
var _a = node.attrs, level = _a.level, attrs = __rest(_a, ["level"]); | ||
changeTextBlock(tr, node, nodes.paragraph, attrs); | ||
changeTextBlock(tr, node, nodes.paragraph, node.attrs); | ||
} | ||
@@ -103,4 +102,3 @@ else if (/^h[1-6]$/i.test(value)) { | ||
else if (value === 'blockquote') { | ||
var _b = node.attrs, level = _b.level, attrs = __rest(_b, ["level"]); | ||
changeTextBlock(tr, node, nodes.blockquote, attrs); | ||
changeTextBlock(tr, node, nodes.blockquote, node.attrs); | ||
} | ||
@@ -146,3 +144,3 @@ } | ||
else if (node.type === nodes.heading) { | ||
result.push("h" + node.attrs.level); | ||
result.push("h".concat(node.attrs.level)); | ||
} | ||
@@ -165,3 +163,3 @@ else if (node.type === nodes.blockquote && nodes.blockquote.isTextblock) { | ||
} | ||
var reducer = function (acc, curr) { return ((acc && curr.value ? acc + ' ' : '') + curr.value ? curr.name + ": " + curr.value + ";" : ''); }; | ||
var reducer = function (acc, curr) { return ((acc && curr.value ? acc + ' ' : '') + curr.value ? "".concat(curr.name, ": ").concat(curr.value, ";") : ''); }; | ||
currentStyles = currentStyles || stylesToApply.reduce(reducer, ''); | ||
@@ -168,0 +166,0 @@ return Object.assign({}, node.attrs, { style: currentStyles || null }); |
@@ -12,3 +12,3 @@ import { wrapIn } from 'prosemirror-commands'; | ||
if (range) { | ||
doc.nodesBetween(range.start, range.end, function (node, pos, _parent, _index) { | ||
doc.nodesBetween(range.start, range.end, function (node, pos) { | ||
if (node.type === nodeType) { | ||
@@ -15,0 +15,0 @@ target = pos; |
@@ -17,5 +17,5 @@ import { __assign } from "tslib"; | ||
// tslint:disable-next-line:no-string-literal | ||
keys['Backspace'] = chainCommands(undoInputRule, deleteSelection, joinBackward, selectNodeBackward); | ||
keys.Backspace = chainCommands(undoInputRule, deleteSelection, joinBackward, selectNodeBackward); | ||
// tslint:disable-next-line:no-string-literal | ||
keys['Enter'] = chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks); | ||
keys.Enter = chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks); | ||
if (!mac) { | ||
@@ -47,5 +47,5 @@ keys['Mod-y'] = redo; | ||
// tslint:disable-next-line:no-string-literal | ||
keys['Enter'] = splitListItemKeepMarks(schema.nodes.list_item); | ||
keys.Enter = splitListItemKeepMarks(schema.nodes.list_item); | ||
} | ||
return keys; | ||
}; |
@@ -11,3 +11,4 @@ import { __assign } from "tslib"; | ||
var result = {}; | ||
var attributes = dom.attributes, attr; | ||
var attributes = dom.attributes; | ||
var attr; | ||
for (var i = 0; i < attributes.length; i++) { | ||
@@ -14,0 +15,0 @@ attr = attributes[i]; |
@@ -1,2 +0,2 @@ | ||
import { setAttribute } from "./utils"; | ||
import { setAttribute } from './utils'; | ||
var DOMSerializer = /** @class */ (function () { | ||
@@ -23,3 +23,3 @@ /// Create a serializer. `nodes` should map node names to functions | ||
if (xmlNS === void 0) { xmlNS = null; } | ||
if (typeof structure === "string") { | ||
if (typeof structure === 'string') { | ||
return { dom: docum.createTextNode(structure) }; | ||
@@ -33,3 +33,3 @@ } | ||
} | ||
var tagName = structure[0], space = tagName.indexOf(" "); | ||
var tagName = structure[0], space = tagName.indexOf(' '); | ||
if (space > 0) { | ||
@@ -42,7 +42,7 @@ xmlNS = tagName.slice(0, space); | ||
var attrs = structure[1], start = 1; | ||
if (attrs && typeof attrs === "object" && attrs.nodeType == null && !Array.isArray(attrs)) { | ||
if (attrs && typeof attrs === 'object' && attrs.nodeType == null && !Array.isArray(attrs)) { | ||
start = 2; | ||
for (var name_1 in attrs) { | ||
if (attrs[name_1] != null) { | ||
space = name_1.indexOf(" "); | ||
space = name_1.indexOf(' '); | ||
if (space > 0) { | ||
@@ -61,3 +61,3 @@ dom.setAttributeNS(name_1.slice(0, space), name_1.slice(space + 1), attrs[name_1]); | ||
if (i < structure.length - 1 || i > start) { | ||
throw new RangeError("Content hole must be the only child of its parent node"); | ||
throw new RangeError('Content hole must be the only child of its parent node'); | ||
} | ||
@@ -71,3 +71,3 @@ return { dom: dom, contentDOM: dom }; | ||
if (contentDOM) { | ||
throw new RangeError("Multiple content holes"); | ||
throw new RangeError('Multiple content holes'); | ||
} | ||
@@ -170,3 +170,3 @@ contentDOM = innerContent; | ||
if (node.isLeaf) { | ||
throw new RangeError("Content hole not allowed in a leaf node spec"); | ||
throw new RangeError('Content hole not allowed in a leaf node spec'); | ||
} | ||
@@ -173,0 +173,0 @@ this.serializeFragment(node.content, options, contentDOM); |
@@ -17,3 +17,3 @@ import { __rest } from "tslib"; | ||
var regExp = useRegExp ? new RegExp(searchText, flags) : createRegExp(searchText, flags); | ||
doc.nodesBetween(start, end, function (node, pos, _parent) { | ||
doc.nodesBetween(start, end, function (node, pos) { | ||
if (exit(result)) { | ||
@@ -20,0 +20,0 @@ return false; |
@@ -23,6 +23,6 @@ import { sinkListItem, liftListItem } from 'prosemirror-schema-list'; | ||
name: style, | ||
value: action.step > 0 ? "" + action.step + action.unit : '' | ||
value: action.step > 0 ? "".concat(action.step).concat(action.unit) : '' | ||
}; | ||
if (node.attrs.style) { | ||
var re = new RegExp(style + ":\\s?(\\d+)" + action.unit, 'i'); | ||
var re = new RegExp("".concat(style, ":\\s?(\\d+)").concat(action.unit), 'i'); | ||
var match = node.attrs.style.match(re); | ||
@@ -32,3 +32,3 @@ if (match) { | ||
newMargin = newMargin <= 0 ? '' : newMargin; | ||
newStyle.value = "" + newMargin + (newMargin ? action.unit : ''); | ||
newStyle.value = "".concat(newMargin).concat(newMargin ? action.unit : ''); | ||
} | ||
@@ -57,3 +57,3 @@ } | ||
var style = dir === 'rtl' ? action.rtlStyle : action.style; | ||
var reIndent = new RegExp(style + ":\\s?\\d+" + action.unit, 'i'); | ||
var reIndent = new RegExp("".concat(style, ":\\s?\\d+").concat(action.unit), 'i'); | ||
result = reIndent.test(node.attrs.style); | ||
@@ -60,0 +60,0 @@ } |
@@ -24,3 +24,3 @@ import { __assign, __spreadArray } from "tslib"; | ||
var style = newStyle.changed ? | ||
{ style: newStyle.style || null } : { style: [attrs.style] + ": " + attrs.newValue + ";" }; | ||
{ style: newStyle.style || null } : { style: "".concat([attrs.style], ": ").concat(attrs.newValue, ";") }; | ||
var currentMark = markType.isInSet(marks) ? marks.find(function (m) { return m.type.name === 'style'; }) : null; | ||
@@ -119,3 +119,3 @@ var newMarkAttrs_1 = currentMark ? __assign(__assign({}, currentMark.attrs), style) : style; | ||
} | ||
var allMarks = __spreadArray([mark], altMarks).filter(function (m) { return marks[m]; }); | ||
var allMarks = __spreadArray([mark], altMarks, true).filter(function (m) { return marks[m]; }); | ||
var toRemove = allMarks.map(function (m) { return hasMark(state, { mark: m }) && marks[m]; }).filter(function (m) { return m; }); | ||
@@ -165,3 +165,3 @@ if (toRemove.length) { | ||
else if (attrs.newValue) { | ||
newStyles.style = [attrs.style] + ": " + attrs.newValue + ";"; | ||
newStyles.style = "".concat([attrs.style], ": ").concat(attrs.newValue, ";"); | ||
} | ||
@@ -168,0 +168,0 @@ var newMarkAttrs_2 = currentMark ? __assign(__assign({}, currentMark.attrs), newStyles) : newStyles; |
@@ -1,6 +0,6 @@ | ||
import { fragmentToHtml, htmlToFragment } from "./source"; | ||
import { fragmentToHtml, htmlToFragment } from './source'; | ||
var msoListRegExp = /style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi; | ||
var extractListLevels = function (html) { | ||
html = html.replace(msoListRegExp, function (match, list, level) { | ||
return "datalist=\"" + list + "\" datalevel=\"" + level + "\" " + match; | ||
return "datalist=\"".concat(list, "\" datalevel=\"").concat(level, "\" ").concat(match); | ||
}); | ||
@@ -7,0 +7,0 @@ return html; |
@@ -139,3 +139,3 @@ import { __assign } from "tslib"; | ||
// Returns all top-level ancestor-nodes between $from and $to | ||
var nodes = Array(); | ||
var nodes = []; | ||
var maxDepth = findAncestorPosition(doc, $from).depth; | ||
@@ -218,2 +218,3 @@ var current = doc.resolve($from.start(maxDepth)); | ||
* Extracts list-style-type style from node's attributes. | ||
* | ||
* @param attrs - The attributes of the list node | ||
@@ -220,0 +221,0 @@ * @returns The extracted list-style-type. |
@@ -61,3 +61,3 @@ import { convertMsLists } from './listConvert'; | ||
if (supportedStyles[name] !== undefined) { | ||
result += name + ": " + value + "; "; | ||
result += "".concat(name, ": ").concat(value, "; "); | ||
} | ||
@@ -156,3 +156,3 @@ }); | ||
var hex = image.replace(reRtfImgHeader, '').replace(reNonHex, ''); | ||
base64Sources.push("data:image/" + extension[1] + ";base64," + convertHexToBase64(hex)); | ||
base64Sources.push("data:image/".concat(extension[1], ";base64,").concat(convertHexToBase64(hex))); | ||
} | ||
@@ -159,0 +159,0 @@ } |
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
import { styleValue } from './../mark'; | ||
@@ -4,0 +4,0 @@ export var caretColorKey = new PluginKey('caret-color'); |
@@ -1,3 +0,3 @@ | ||
import { Plugin, PluginKey } from "prosemirror-state"; | ||
import { setAttribute } from "../utils"; | ||
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { setAttribute } from '../utils'; | ||
var setAttributes = function (dom, attrs) { | ||
@@ -22,3 +22,3 @@ for (var attrName in attrs) { | ||
var StyleView = /** @class */ (function () { | ||
function StyleView(mark, view, _inline) { | ||
function StyleView(mark, view) { | ||
this.mark = mark; | ||
@@ -48,3 +48,3 @@ this.view = view; | ||
markViews: { | ||
style: function (mark, view, inline) { return new StyleView(mark, view, inline); } | ||
style: function (mark, view) { return new StyleView(mark, view); } | ||
} | ||
@@ -51,0 +51,0 @@ } |
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
// https://discuss.prosemirror.net/t/passing-data-between-plugins/1843 | ||
@@ -4,0 +4,0 @@ export var textHighlightKey = new PluginKey('highlight'); |
import { __assign } from "tslib"; | ||
import { NodeSelection, Plugin, PluginKey } from "prosemirror-state"; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { dataResizeDirImage, resizeHandle } from "../config/constants"; | ||
import { changeStylesString } from "../utils"; | ||
import { NodeSelection, Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
import { dataResizeDirImage, resizeHandle } from '../config/constants'; | ||
import { changeStylesString } from '../utils'; | ||
import { directions, handles } from './resize-utils'; | ||
@@ -21,7 +21,7 @@ export var imageResizeKey = new PluginKey('image-resize'); | ||
ResizeState.prototype.apply = function (tr) { | ||
var state = this, next = tr.getMeta(imageResizeKey); | ||
var next = tr.getMeta(imageResizeKey); | ||
if (next) { | ||
return new ResizeState(next.activeHandle, next.setDragging, next.rect, next.nodePosition); | ||
} | ||
return state; | ||
return this; | ||
}; | ||
@@ -28,0 +28,0 @@ return ResizeState; |
@@ -39,3 +39,3 @@ import { __assign } from "tslib"; | ||
var transaction = state.tr, doc = state.doc, _a = state.selection, from = _a.from, to = _a.to; | ||
doc.nodesBetween(from, to, function (node, pos, _parent) { | ||
doc.nodesBetween(from, to, function (node, pos) { | ||
if (node.type.name === options.listItem && inSelection(from, to, pos, node, doc)) { | ||
@@ -58,3 +58,3 @@ var attrs_1 = node.attrs; | ||
if (mark.type.name === 'style' && mark.attrs.style) { | ||
var _a = mark.attrs.style.split(/\s*:\s*/), name_1 = _a[0], _value = _a[1]; | ||
var name_1 = mark.attrs.style.split(/\s*:\s*/)[0]; | ||
var $pos = transaction.doc.resolve(step.from); | ||
@@ -65,3 +65,3 @@ var li = parentNode($pos, function (n) { return n.type.name === options.listItem; }); | ||
if (liStyles[name_1] && options.resetValues[name_1]) { | ||
var newMark = mark.type.create({ style: name_1 + ": " + options.resetValues[name_1] + ";" }); | ||
var newMark = mark.type.create({ style: "".concat(name_1, ": ").concat(options.resetValues[name_1], ";") }); | ||
transaction.addMark(step.from, step.to, newMark); | ||
@@ -68,0 +68,0 @@ } |
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
export function placeholder(message) { | ||
@@ -4,0 +4,0 @@ var decAttrs = { class: 'k-placeholder', 'data-placeholder': message }; |
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
// The plugin resolves the following problems: | ||
@@ -4,0 +4,0 @@ // |
@@ -14,3 +14,3 @@ import { __assign } from "tslib"; | ||
state: { | ||
init: function (_, _state) { | ||
init: function () { | ||
return new ResizeState(-1, null); | ||
@@ -71,3 +71,4 @@ }, | ||
ResizeState.prototype.apply = function (tr) { | ||
var state = this, action = tr.getMeta(key); | ||
var state; | ||
var action = tr.getMeta(key); | ||
if (action && action.setHandle != null) { | ||
@@ -77,12 +78,12 @@ return new ResizeState(action.setHandle, null); | ||
if (action && action.setDragging !== undefined) { | ||
return new ResizeState(state.activeHandle, action.setDragging); | ||
return new ResizeState(this.activeHandle, action.setDragging); | ||
} | ||
if (state.activeHandle > -1 && tr.docChanged) { | ||
var handle = tr.mapping.map(state.activeHandle, -1); | ||
if (this.activeHandle > -1 && tr.docChanged) { | ||
var handle = tr.mapping.map(this.activeHandle, -1); | ||
if (!pointsAtCell(tr.doc.resolve(handle))) { | ||
handle = -1; | ||
} | ||
state = new ResizeState(handle, state.dragging); | ||
state = new ResizeState(handle, this.dragging); | ||
} | ||
return state; | ||
return state || this; | ||
}; | ||
@@ -94,3 +95,4 @@ return ResizeState; | ||
if (!pluginState.dragging) { | ||
var target = domCellAround(event.target), cell = -1; | ||
var target = domCellAround(event.target); | ||
var cell = -1; | ||
if (target) { | ||
@@ -179,3 +181,3 @@ var indexes = cellIndexes(target); | ||
var transaction = view.state.tr; | ||
updateColumnWidth(view, transaction, curPluginState.activeHandle, draggedWidth(curPluginState.dragging, ev, cellMinWidth)); | ||
updateColumnWidth(view, transaction, curPluginState.activeHandle); | ||
view.dispatch(transaction.setMeta(key, { setDragging: null })); | ||
@@ -190,3 +192,3 @@ } | ||
var dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth); | ||
displayColumnWidth(view, curPluginState.activeHandle, dragged, cellMinWidth); | ||
displayColumnWidth(view, curPluginState.activeHandle, dragged); | ||
} | ||
@@ -208,3 +210,3 @@ event.view.addEventListener('mouseup', finish); | ||
} | ||
function updateColumnWidth(view, tr, cell, _width) { | ||
function updateColumnWidth(view, tr, cell) { | ||
var _a; | ||
@@ -226,3 +228,3 @@ var $cell = view.state.doc.resolve(cell); | ||
} | ||
function displayColumnWidth(view, cell, width, _cellMinWidth) { | ||
function displayColumnWidth(view, cell, width) { | ||
var $cell = view.state.doc.resolve(cell); | ||
@@ -229,0 +231,0 @@ var table = $cell.node(-1), start = $cell.start(-1); |
@@ -20,3 +20,3 @@ import { Plugin } from 'prosemirror-state'; | ||
init: function (_, state) { | ||
this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] = function (_node, _view) { return new TableRowView(); }; | ||
this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] = function () { return new TableRowView(); }; | ||
return new ResizeState(-1, null); | ||
@@ -74,3 +74,3 @@ }, | ||
ResizeState.prototype.apply = function (tr) { | ||
var state = this, action = tr.getMeta(key); | ||
var state, action = tr.getMeta(key); | ||
if (action && action.setHandle != null) { | ||
@@ -80,12 +80,12 @@ return new ResizeState(action.setHandle, null); | ||
if (action && action.setDragging !== undefined) { | ||
return new ResizeState(state.activeHandle, action.setDragging); | ||
return new ResizeState(this.activeHandle, action.setDragging); | ||
} | ||
if (state.activeHandle > -1) { | ||
var handle = tr.mapping.map(state.activeHandle, -1); | ||
if (this.activeHandle > -1) { | ||
var handle = tr.mapping.map(this.activeHandle, -1); | ||
if (!pointsAtCell(tr.doc.resolve(handle))) { | ||
handle = null; | ||
} | ||
state = new ResizeState(handle, state.dragging); | ||
state = new ResizeState(handle, this.dragging); | ||
} | ||
return state; | ||
return state || this; | ||
}; | ||
@@ -92,0 +92,0 @@ return ResizeState; |
@@ -22,3 +22,3 @@ import { __assign } from "tslib"; | ||
ResizeState.prototype.apply = function (tr) { | ||
var state = this, next = tr.getMeta(key); | ||
var next = tr.getMeta(key); | ||
if (next) { | ||
@@ -28,3 +28,3 @@ var nextState = new ResizeState(next.activeHandle, next.setDragging, next.nodePosition); | ||
} | ||
return state; | ||
return this; | ||
}; | ||
@@ -199,3 +199,3 @@ return ResizeState; | ||
} | ||
function finish(_e) { | ||
function finish() { | ||
curWindow.removeEventListener('mouseup', finish); | ||
@@ -213,3 +213,3 @@ curWindow.removeEventListener('mousemove', move); | ||
key: key, | ||
view: function (_viewObj) { return ({ | ||
view: function () { return ({ | ||
selectedNode: function (state, nodeType) { | ||
@@ -230,3 +230,3 @@ var selection = state.selection; | ||
update: function (view, prevState) { | ||
var _a, _b, _c, _d, _f; | ||
var _a, _b, _c, _d, _e; | ||
var state = view.state; | ||
@@ -263,3 +263,3 @@ var nodeType = state.schema.nodes[options.node]; | ||
tr.setMeta(key, { nodePosition: -1 }); | ||
view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, __assign(__assign({}, prevSelected.node.attrs), (_f = {}, _f[resizableAttr] = false, _f)))); | ||
view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, __assign(__assign({}, prevSelected.node.attrs), (_e = {}, _e[resizableAttr] = false, _e)))); | ||
} | ||
@@ -266,0 +266,0 @@ } |
@@ -175,2 +175,3 @@ import { DOMParser as ProseMirrorDOMParser } from 'prosemirror-model'; | ||
* Creates a DocumentFragment from the given ProseMirrorNode. | ||
* | ||
* @param doc ProseMirrorNode | ||
@@ -177,0 +178,0 @@ * @returns DocumentFragment |
@@ -7,2 +7,3 @@ import { __assign } from "tslib"; | ||
* Creates a table. | ||
* | ||
* @returns Node | ||
@@ -9,0 +10,0 @@ */ |
@@ -18,3 +18,3 @@ import { __assign } from "tslib"; | ||
if (newValue) { | ||
filtered.push(styleToChange + ": " + newValue); | ||
filtered.push("".concat(styleToChange, ": ").concat(newValue)); | ||
} | ||
@@ -255,3 +255,3 @@ return { | ||
export var expandToWordWrap = function (command, options) { | ||
return function (state, dispatch, _view) { | ||
return function (state, dispatch) { | ||
var _a = expandSelection(state, dispatch, options), cmdState = _a.state, cmdDispatch = _a.dispatch; | ||
@@ -273,3 +273,3 @@ return command(options)(cmdState, cmdDispatch); | ||
var result = Object.keys(styles) | ||
.map(function (name) { return styles[name] ? name + ": " + styles[name] : null; }) | ||
.map(function (name) { return styles[name] ? "".concat(name, ": ").concat(styles[name]) : null; }) | ||
.filter(Boolean) | ||
@@ -276,0 +276,0 @@ .join('; '); |
@@ -10,3 +10,3 @@ import { __rest } from "tslib"; | ||
const canChangeType = (stateDoc, pos, type) => { | ||
let $pos = stateDoc.resolve(pos), index = $pos.index(); | ||
const $pos = stateDoc.resolve(pos), index = $pos.index(); | ||
return $pos.parent.canReplaceWith(index, index + 1, type); | ||
@@ -36,5 +36,5 @@ }; | ||
tr.clearIncompatible(tr.mapping.slice(mapFrom).map(pos, 1), nodeType); | ||
let mapping = tr.mapping.slice(mapFrom); | ||
let startM = mapping.map(pos, 1), endM = mapping.map(pos + currNode.nodeSize, 1); | ||
let slice = new Slice(Fragment.from(nodeType.create(attrs, null, currNode.marks)), 0, 0); | ||
const mapping = tr.mapping.slice(mapFrom); | ||
const startM = mapping.map(pos, 1), endM = mapping.map(pos + currNode.nodeSize, 1); | ||
const slice = new Slice(Fragment.from(nodeType.create(attrs, null, currNode.marks)), 0, 0); | ||
tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, slice, 1, true)); | ||
@@ -54,3 +54,3 @@ return false; // this will skip the node children | ||
const { doc, selection } = state; | ||
let { $from, ranges } = selection; | ||
const { $from, ranges } = selection; | ||
const { blocksInSelection } = options; | ||
@@ -76,3 +76,3 @@ const result = []; | ||
const to = range.$to.pos; | ||
doc.nodesBetween(from, to, (node, pos, _parent, _index) => { | ||
doc.nodesBetween(from, to, (node, pos) => { | ||
if (node.isBlock && (!blocksInSelection || (pos >= from && pos + node.content.size + 2 <= to))) { | ||
@@ -95,4 +95,3 @@ result.push(node); | ||
if (value === 'p') { | ||
const _a = node.attrs, { level } = _a, attrs = __rest(_a, ["level"]); | ||
changeTextBlock(tr, node, nodes.paragraph, attrs); | ||
changeTextBlock(tr, node, nodes.paragraph, node.attrs); | ||
} | ||
@@ -104,4 +103,3 @@ else if (/^h[1-6]$/i.test(value)) { | ||
else if (value === 'blockquote') { | ||
const _b = node.attrs, { level } = _b, attrs = __rest(_b, ["level"]); | ||
changeTextBlock(tr, node, nodes.blockquote, attrs); | ||
changeTextBlock(tr, node, nodes.blockquote, node.attrs); | ||
} | ||
@@ -168,3 +166,3 @@ } | ||
export const hasNode = (state, nodeType) => { | ||
let { from, to } = state.selection; | ||
const { from, to } = state.selection; | ||
let result = false; | ||
@@ -171,0 +169,0 @@ state.doc.nodesBetween(from, to, node => { |
@@ -12,3 +12,3 @@ import { wrapIn } from 'prosemirror-commands'; | ||
if (range) { | ||
doc.nodesBetween(range.start, range.end, (node, pos, _parent, _index) => { | ||
doc.nodesBetween(range.start, range.end, (node, pos) => { | ||
if (node.type === nodeType) { | ||
@@ -15,0 +15,0 @@ target = pos; |
@@ -16,5 +16,5 @@ import { chainCommands, exitCode, newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks, deleteSelection, joinBackward, selectNodeBackward } from 'prosemirror-commands'; | ||
// tslint:disable-next-line:no-string-literal | ||
keys['Backspace'] = chainCommands(undoInputRule, deleteSelection, joinBackward, selectNodeBackward); | ||
keys.Backspace = chainCommands(undoInputRule, deleteSelection, joinBackward, selectNodeBackward); | ||
// tslint:disable-next-line:no-string-literal | ||
keys['Enter'] = chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks); | ||
keys.Enter = chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks); | ||
if (!mac) { | ||
@@ -46,5 +46,5 @@ keys['Mod-y'] = redo; | ||
// tslint:disable-next-line:no-string-literal | ||
keys['Enter'] = splitListItemKeepMarks(schema.nodes.list_item); | ||
keys.Enter = splitListItemKeepMarks(schema.nodes.list_item); | ||
} | ||
return keys; | ||
}; |
@@ -10,3 +10,4 @@ import { Schema } from 'prosemirror-model'; | ||
const result = {}; | ||
let attributes = dom.attributes, attr; | ||
const attributes = dom.attributes; | ||
let attr; | ||
for (let i = 0; i < attributes.length; i++) { | ||
@@ -27,3 +28,3 @@ attr = attributes[i]; | ||
const hasAttrs = (attrs, exclude) => { | ||
for (let attr in attrs) { | ||
for (const attr in attrs) { | ||
if (attr && attrs[attr] !== null && attr !== exclude) { | ||
@@ -37,3 +38,3 @@ return true; | ||
const result = {}; | ||
for (let attr in attrs) { | ||
for (const attr in attrs) { | ||
if (attr && attrs[attr] !== null && !exclude.find(e => e === attr)) { | ||
@@ -40,0 +41,0 @@ result[attr] = attrs[attr]; |
@@ -1,18 +0,3 @@ | ||
import { setAttribute } from "./utils"; | ||
import { setAttribute } from './utils'; | ||
export class DOMSerializer { | ||
/// Create a serializer. `nodes` should map node names to functions | ||
/// that take a node and return a description of the corresponding | ||
/// DOM. `marks` does the same for mark names, but also gets an | ||
/// argument that tells it whether the mark's content is block or | ||
/// inline content (for typical use, it'll always be inline). A mark | ||
/// serializer may be `null` to indicate that marks of that type | ||
/// should not be serialized. | ||
constructor( | ||
/// The node serialization functions. | ||
nodes, | ||
/// The mark serialization functions. | ||
marks) { | ||
this.nodes = nodes; | ||
this.marks = marks; | ||
} | ||
/// Render an [output spec](#model.DOMOutputSpec) to a DOM node. If | ||
@@ -22,3 +7,3 @@ /// the spec has a hole (zero) in it, `contentDOM` will point at the | ||
static renderSpec(docum, structure, xmlNS = null) { | ||
if (typeof structure === "string") { | ||
if (typeof structure === 'string') { | ||
return { dom: docum.createTextNode(structure) }; | ||
@@ -32,3 +17,3 @@ } | ||
} | ||
let tagName = structure[0], space = tagName.indexOf(" "); | ||
let tagName = structure[0], space = tagName.indexOf(' '); | ||
if (space > 0) { | ||
@@ -39,9 +24,9 @@ xmlNS = tagName.slice(0, space); | ||
let contentDOM; | ||
let dom = (xmlNS ? docum.createElementNS(xmlNS, tagName) : docum.createElement(tagName)); | ||
const dom = (xmlNS ? docum.createElementNS(xmlNS, tagName) : docum.createElement(tagName)); | ||
let attrs = structure[1], start = 1; | ||
if (attrs && typeof attrs === "object" && attrs.nodeType == null && !Array.isArray(attrs)) { | ||
if (attrs && typeof attrs === 'object' && attrs.nodeType == null && !Array.isArray(attrs)) { | ||
start = 2; | ||
for (let name in attrs) { | ||
for (const name in attrs) { | ||
if (attrs[name] != null) { | ||
space = name.indexOf(" "); | ||
space = name.indexOf(' '); | ||
if (space > 0) { | ||
@@ -57,6 +42,6 @@ dom.setAttributeNS(name.slice(0, space), name.slice(space + 1), attrs[name]); | ||
for (let i = start; i < structure.length; i++) { | ||
let child = structure[i]; | ||
const child = structure[i]; | ||
if (child === 0) { | ||
if (i < structure.length - 1 || i > start) { | ||
throw new RangeError("Content hole must be the only child of its parent node"); | ||
throw new RangeError('Content hole must be the only child of its parent node'); | ||
} | ||
@@ -66,7 +51,7 @@ return { dom, contentDOM: dom }; | ||
else { | ||
let { dom: inner, contentDOM: innerContent } = DOMSerializer.renderSpec(docum, child, xmlNS); | ||
const { dom: inner, contentDOM: innerContent } = DOMSerializer.renderSpec(docum, child, xmlNS); | ||
dom.appendChild(inner); | ||
if (innerContent) { | ||
if (contentDOM) { | ||
throw new RangeError("Multiple content holes"); | ||
throw new RangeError('Multiple content holes'); | ||
} | ||
@@ -88,3 +73,3 @@ contentDOM = innerContent; | ||
static nodesFromSchema(schema) { | ||
let result = gatherToDOM(schema.nodes); | ||
const result = gatherToDOM(schema.nodes); | ||
if (!result.text) { | ||
@@ -99,2 +84,17 @@ result.text = node => node.text; | ||
} | ||
/// Create a serializer. `nodes` should map node names to functions | ||
/// that take a node and return a description of the corresponding | ||
/// DOM. `marks` does the same for mark names, but also gets an | ||
/// argument that tells it whether the mark's content is block or | ||
/// inline content (for typical use, it'll always be inline). A mark | ||
/// serializer may be `null` to indicate that marks of that type | ||
/// should not be serialized. | ||
constructor( | ||
/// The node serialization functions. | ||
nodes, | ||
/// The mark serialization functions. | ||
marks) { | ||
this.nodes = nodes; | ||
this.marks = marks; | ||
} | ||
/// Serialize the content of this fragment to a DOM fragment. When | ||
@@ -113,3 +113,3 @@ /// not in the browser, the `document` option, containing a DOM | ||
while (keep < active.length && rendered < node.marks.length) { | ||
let next = node.marks[rendered]; | ||
const next = node.marks[rendered]; | ||
if (!this.marks[next.type.name]) { | ||
@@ -129,4 +129,4 @@ rendered++; | ||
while (rendered < node.marks.length) { | ||
let add = node.marks[rendered++]; | ||
let markDOM = this.serializeMark(add, node.isInline, options); | ||
const add = node.marks[rendered++]; | ||
const markDOM = this.serializeMark(add, node.isInline, options); | ||
if (markDOM) { | ||
@@ -151,3 +151,3 @@ active.push([add, top]); | ||
for (let i = node.marks.length - 1; i >= 0; i--) { | ||
let wrap = this.serializeMark(node.marks[i], node.isInline, options); | ||
const wrap = this.serializeMark(node.marks[i], node.isInline, options); | ||
if (wrap) { | ||
@@ -162,3 +162,3 @@ (wrap.contentDOM || wrap.dom).appendChild(dom); | ||
serializeMark(mark, inline, options = {}) { | ||
let toDOM = this.marks[mark.type.name]; | ||
const toDOM = this.marks[mark.type.name]; | ||
return toDOM && DOMSerializer.renderSpec(doc(options), toDOM(mark, inline)); | ||
@@ -168,6 +168,6 @@ } | ||
serializeNodeInner(node, options) { | ||
let { dom, contentDOM } = DOMSerializer.renderSpec(doc(options), this.nodes[node.type.name](node)); | ||
const { dom, contentDOM } = DOMSerializer.renderSpec(doc(options), this.nodes[node.type.name](node)); | ||
if (contentDOM) { | ||
if (node.isLeaf) { | ||
throw new RangeError("Content hole not allowed in a leaf node spec"); | ||
throw new RangeError('Content hole not allowed in a leaf node spec'); | ||
} | ||
@@ -180,6 +180,6 @@ this.serializeFragment(node.content, options, contentDOM); | ||
function gatherToDOM(obj) { | ||
let result = {}; | ||
for (let name in obj) { | ||
const result = {}; | ||
for (const name in obj) { | ||
if (obj[name]) { | ||
let toDOM = obj[name].spec.toDOM; | ||
const toDOM = obj[name].spec.toDOM; | ||
if (toDOM) { | ||
@@ -186,0 +186,0 @@ result[name] = toDOM; |
@@ -17,3 +17,3 @@ import { __rest } from "tslib"; | ||
const regExp = useRegExp ? new RegExp(searchText, flags) : createRegExp(searchText, flags); | ||
doc.nodesBetween(start, end, (node, pos, _parent) => { | ||
doc.nodesBetween(start, end, (node, pos) => { | ||
if (exit(result)) { | ||
@@ -20,0 +20,0 @@ return false; |
@@ -17,5 +17,5 @@ import { AddMarkStep, RemoveMarkStep } from 'prosemirror-transform'; | ||
} | ||
let marks = node.marks; | ||
const marks = node.marks; | ||
if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) { | ||
let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to); | ||
const start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to); | ||
const newStyle = changeStyleFromMark(marks, attrs); | ||
@@ -28,3 +28,3 @@ if (newStyle.changed || attrs.newValue) { | ||
const newStyleMark = markType.create(newMarkAttrs); | ||
let newSet = newStyleMark.addToSet(marks); | ||
const newSet = newStyleMark.addToSet(marks); | ||
for (let i = 0; i < marks.length; i++) { | ||
@@ -93,3 +93,3 @@ if (!marks[i].isInSet(newSet)) { | ||
for (let i = 0; i < ranges.length; i++) { | ||
let { $from, $to } = ranges[i]; | ||
const { $from, $to } = ranges[i]; | ||
result = changeStyleMark(transaction, $from.pos, $to.pos, attrs, markType) || result; | ||
@@ -149,3 +149,3 @@ } | ||
tr.setMeta('args', options); | ||
let { empty, $cursor, ranges } = state.selection; | ||
const { empty, $cursor, ranges } = state.selection; | ||
if ((empty && !$cursor) || !markType || !markApplies(state.doc, ranges, markType)) { | ||
@@ -152,0 +152,0 @@ return false; |
@@ -1,2 +0,2 @@ | ||
import { fragmentToHtml, htmlToFragment } from "./source"; | ||
import { fragmentToHtml, htmlToFragment } from './source'; | ||
const msoListRegExp = /style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi; | ||
@@ -48,3 +48,3 @@ const extractListLevels = (html) => { | ||
} | ||
let element = node; | ||
const element = node; | ||
if (element.getAttribute('datalist')) { | ||
@@ -72,3 +72,3 @@ group.push(node); | ||
let html = p.innerHTML; | ||
let trimStartText = (t) => { | ||
const trimStartText = (t) => { | ||
return t.replace(/^(?: |[\u00a0\n\r\s])+/, ''); | ||
@@ -130,4 +130,4 @@ }; | ||
}; | ||
let listIndex = listData.datalist; | ||
let listType = listTypes(p); | ||
const listIndex = listData.datalist; | ||
const listType = listTypes(p); | ||
type = listType && listType.tag; | ||
@@ -151,3 +151,3 @@ if (!type) { | ||
} | ||
let levelType = type + listIndex; | ||
const levelType = type + listIndex; | ||
if (!levels[margin]) { | ||
@@ -154,0 +154,0 @@ levels[margin] = {}; |
@@ -97,3 +97,3 @@ import { Fragment, Slice, NodeRange } from 'prosemirror-model'; | ||
const listItemNodeType = nodeType || state.schema.nodes.listItem; | ||
let { $from, $to } = selection; | ||
const { $from, $to } = selection; | ||
let range = $from.blockRange($to, node => node.childCount && node.firstChild.type === listItemNodeType); | ||
@@ -103,4 +103,4 @@ if (!range || range.depth < 2 || $from.node(range.depth - 1).type !== listItemNodeType) { | ||
} | ||
let end = range.end; | ||
let endOfList = $to.end(range.depth); | ||
const end = range.end; | ||
const endOfList = $to.end(range.depth); | ||
if (end < endOfList) { | ||
@@ -140,3 +140,3 @@ tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(listItemNodeType.create(undefined, range.parent.copy())), 1, 0), 1, true)); | ||
// Returns all top-level ancestor-nodes between $from and $to | ||
const nodes = Array(); | ||
const nodes = []; | ||
const maxDepth = findAncestorPosition(doc, $from).depth; | ||
@@ -218,2 +218,3 @@ let current = doc.resolve($from.start(maxDepth)); | ||
* Extracts list-style-type style from node's attributes. | ||
* | ||
* @param attrs - The attributes of the list node | ||
@@ -260,3 +261,3 @@ * @returns The extracted list-style-type. | ||
return splitListItem(itemType)(state, tr => { | ||
let marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks()); | ||
const marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks()); | ||
if (marks) { | ||
@@ -263,0 +264,0 @@ tr.ensureMarks(marks); |
import { RemoveMarkStep } from 'prosemirror-transform'; | ||
import { MarkType } from 'prosemirror-model'; | ||
export const markApplies = (doc, ranges, type) => { | ||
let loop = i => { | ||
let ref = ranges[i]; | ||
let $from = ref.$from; | ||
let $to = ref.$to; | ||
const loop = i => { | ||
const ref = ranges[i]; | ||
const $from = ref.$from; | ||
const $to = ref.$to; | ||
let can = $from.depth === 0 ? doc.type.allowsMarkType(type) : false; | ||
@@ -20,3 +20,3 @@ doc.nodesBetween($from.pos, $to.pos, node => { | ||
for (let i = 0; i < ranges.length; i++) { | ||
let returned = loop(i); | ||
const returned = loop(i); | ||
if (returned) { | ||
@@ -29,3 +29,3 @@ return returned.v; | ||
export const toggleMark = (markType, attrs, tr) => (state, dispatch) => { | ||
let { empty, $cursor, ranges } = state.selection; | ||
const { empty, $cursor, ranges } = state.selection; | ||
if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType)) { | ||
@@ -46,7 +46,7 @@ return false; | ||
for (let i = 0; !has && i < ranges.length; i++) { | ||
let { $from, $to } = ranges[i]; | ||
const { $from, $to } = ranges[i]; | ||
has = state.doc.rangeHasMark($from.pos, $to.pos, markType); | ||
} | ||
for (let i = 0; i < ranges.length; i++) { | ||
let { $from, $to } = ranges[i]; | ||
const { $from, $to } = ranges[i]; | ||
if (has) { | ||
@@ -76,3 +76,3 @@ tr.removeMark($from.pos, $to.pos, markType); | ||
if (mark instanceof MarkType) { | ||
let found = mark.isInSet(node.marks); | ||
const found = mark.isInSet(node.marks); | ||
if (found) { | ||
@@ -91,7 +91,7 @@ toRemove = [found]; | ||
if (toRemove && toRemove.length) { | ||
let end = Math.min(pos + node.nodeSize, to); | ||
const end = Math.min(pos + node.nodeSize, to); | ||
for (let i = 0; i < toRemove.length; i++) { | ||
let style = toRemove[i], found$1 = (void 0); | ||
for (let j = 0; j < matched.length; j++) { | ||
let m = matched[j]; | ||
const m = matched[j]; | ||
if (m.step === step - 1 && style.eq(m.style)) { | ||
@@ -115,3 +115,3 @@ found$1 = m; | ||
export const removeMarks = (marks, state, dispatch, tr) => { | ||
let { $cursor, ranges } = state.selection; | ||
const { $cursor, ranges } = state.selection; | ||
tr = tr || state.tr; | ||
@@ -127,3 +127,3 @@ if ($cursor) { | ||
for (let i = 0; i < ranges.length; i++) { | ||
let { $from, $to } = ranges[i]; | ||
const { $from, $to } = ranges[i]; | ||
marks.forEach(m => { | ||
@@ -174,3 +174,3 @@ removeMark(tr, $from.pos, $to.pos, m); | ||
const altStyle = options.altStyle; | ||
let { from, $from, to, empty } = state.selection; | ||
const { from, $from, to, empty } = state.selection; | ||
const type = marks[options.mark]; | ||
@@ -208,4 +208,4 @@ const doc = state.doc; | ||
export const selectionMarks = (state, markType) => { | ||
let { from, $from, to, empty } = state.selection; | ||
let marks = []; | ||
const { from, $from, to, empty } = state.selection; | ||
const marks = []; | ||
if (empty) { | ||
@@ -238,3 +238,3 @@ marks.push(markType.isInSet(state.storedMarks || $from.marks())); | ||
const filtered = marks.filter(m => Boolean(m)); | ||
let hasNodesWithoutMarks = marks.length !== filtered.length; | ||
const hasNodesWithoutMarks = marks.length !== filtered.length; | ||
return { | ||
@@ -241,0 +241,0 @@ hasNodesWithoutMarks, |
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
import { styleValue } from './../mark'; | ||
@@ -4,0 +4,0 @@ export const caretColorKey = new PluginKey('caret-color'); |
@@ -1,5 +0,5 @@ | ||
import { Plugin, PluginKey } from "prosemirror-state"; | ||
import { setAttribute } from "../utils"; | ||
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { setAttribute } from '../utils'; | ||
const setAttributes = (dom, attrs) => { | ||
for (let attrName in attrs) { | ||
for (const attrName in attrs) { | ||
if (attrName) { | ||
@@ -20,3 +20,3 @@ setAttribute(dom, attrName, attrs[attrName]); | ||
class StyleView { | ||
constructor(mark, view, _inline) { | ||
constructor(mark, view) { | ||
this.mark = mark; | ||
@@ -45,3 +45,3 @@ this.view = view; | ||
markViews: { | ||
style: (mark, view, inline) => new StyleView(mark, view, inline) | ||
style: (mark, view) => new StyleView(mark, view) | ||
} | ||
@@ -48,0 +48,0 @@ } |
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
// https://discuss.prosemirror.net/t/passing-data-between-plugins/1843 | ||
@@ -4,0 +4,0 @@ export const textHighlightKey = new PluginKey('highlight'); |
@@ -1,5 +0,5 @@ | ||
import { NodeSelection, Plugin, PluginKey } from "prosemirror-state"; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { dataResizeDirImage, resizeHandle } from "../config/constants"; | ||
import { changeStylesString } from "../utils"; | ||
import { NodeSelection, Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
import { dataResizeDirImage, resizeHandle } from '../config/constants'; | ||
import { changeStylesString } from '../utils'; | ||
import { directions, handles } from './resize-utils'; | ||
@@ -20,7 +20,7 @@ export const imageResizeKey = new PluginKey('image-resize'); | ||
apply(tr) { | ||
let state = this, next = tr.getMeta(imageResizeKey); | ||
const next = tr.getMeta(imageResizeKey); | ||
if (next) { | ||
return new ResizeState(next.activeHandle, next.setDragging, next.rect, next.nodePosition); | ||
} | ||
return state; | ||
return this; | ||
} | ||
@@ -41,5 +41,5 @@ } | ||
if (options.lockRatio && dir.x && dir.y) { | ||
let ratio = Math.min(width / img.width, height / img.height); | ||
let lockWidth = img.width * ratio; | ||
let lockHeight = img.height * ratio; | ||
const ratio = Math.min(width / img.width, height / img.height); | ||
const lockWidth = img.width * ratio; | ||
const lockHeight = img.height * ratio; | ||
dragging.startX = event.clientX - (width - lockWidth) * dir.x; | ||
@@ -213,3 +213,3 @@ dragging.startY = event.clientY - (height - lockHeight) * dir.y; | ||
for (let i = 0; i < handles.length; i++) { | ||
let dom = document.createElement('div'); | ||
const dom = document.createElement('div'); | ||
dom.className = resizeHandle + ' ' + handles[i]; | ||
@@ -216,0 +216,0 @@ dom.setAttribute(dataResizeDirImage, handles[i]); |
@@ -38,3 +38,3 @@ import { Plugin, PluginKey } from 'prosemirror-state'; | ||
const { tr: transaction, doc, selection: { from, to } } = state; | ||
doc.nodesBetween(from, to, (node, pos, _parent) => { | ||
doc.nodesBetween(from, to, (node, pos) => { | ||
if (node.type.name === options.listItem && inSelection(from, to, pos, node, doc)) { | ||
@@ -57,3 +57,3 @@ let attrs = node.attrs; | ||
if (mark.type.name === 'style' && mark.attrs.style) { | ||
const [name, _value] = mark.attrs.style.split(/\s*:\s*/); | ||
const [name] = mark.attrs.style.split(/\s*:\s*/); | ||
const $pos = transaction.doc.resolve(step.from); | ||
@@ -60,0 +60,0 @@ const li = parentNode($pos, n => n.type.name === options.listItem); |
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
export function placeholder(message) { | ||
@@ -4,0 +4,0 @@ const decAttrs = { class: 'k-placeholder', 'data-placeholder': message }; |
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { Decoration, DecorationSet } from "prosemirror-view"; | ||
import { Decoration, DecorationSet } from 'prosemirror-view'; | ||
// The plugin resolves the following problems: | ||
@@ -4,0 +4,0 @@ // |
@@ -10,6 +10,6 @@ import { Plugin } from 'prosemirror-state'; | ||
const handleWidth = 5, cellMinWidth = 25; | ||
let plugin = new Plugin({ | ||
const plugin = new Plugin({ | ||
key, | ||
state: { | ||
init(_, _state) { | ||
init() { | ||
return new ResizeState(-1, null); | ||
@@ -26,3 +26,3 @@ }, | ||
} | ||
let pluginState = key.getState(state); | ||
const pluginState = key.getState(state); | ||
return pluginState.activeHandle > -1 ? { class: 'resize-cursor' } : null; | ||
@@ -47,3 +47,3 @@ }, | ||
if (!otherResizing(key, state)) { | ||
let pluginState = key.getState(state); | ||
const pluginState = key.getState(state); | ||
if (pluginState.activeHandle > -1) { | ||
@@ -72,3 +72,4 @@ return handleDecorations(state, pluginState.activeHandle); | ||
apply(tr) { | ||
let state = this, action = tr.getMeta(key); | ||
let state; | ||
const action = tr.getMeta(key); | ||
if (action && action.setHandle != null) { | ||
@@ -78,21 +79,22 @@ return new ResizeState(action.setHandle, null); | ||
if (action && action.setDragging !== undefined) { | ||
return new ResizeState(state.activeHandle, action.setDragging); | ||
return new ResizeState(this.activeHandle, action.setDragging); | ||
} | ||
if (state.activeHandle > -1 && tr.docChanged) { | ||
let handle = tr.mapping.map(state.activeHandle, -1); | ||
if (this.activeHandle > -1 && tr.docChanged) { | ||
let handle = tr.mapping.map(this.activeHandle, -1); | ||
if (!pointsAtCell(tr.doc.resolve(handle))) { | ||
handle = -1; | ||
} | ||
state = new ResizeState(handle, state.dragging); | ||
state = new ResizeState(handle, this.dragging); | ||
} | ||
return state; | ||
return state || this; | ||
} | ||
} | ||
function handleMouseMove(view, event, handleWidth) { | ||
let pluginState = key.getState(view.state); | ||
const pluginState = key.getState(view.state); | ||
if (!pluginState.dragging) { | ||
let target = domCellAround(event.target), cell = -1; | ||
const target = domCellAround(event.target); | ||
let cell = -1; | ||
if (target) { | ||
const indexes = cellIndexes(target); | ||
let { left, right } = target.getBoundingClientRect(); | ||
const { left, right } = target.getBoundingClientRect(); | ||
if (Math.abs(event.clientX - left) <= handleWidth && indexes.cellIndex > 0) { | ||
@@ -112,3 +114,3 @@ indexes.cellIndex -= target.colSpan; | ||
function handleMouseLeave(view) { | ||
let pluginState = key.getState(view.state); | ||
const pluginState = key.getState(view.state); | ||
if (pluginState.activeHandle > -1 && !pluginState.dragging) { | ||
@@ -119,7 +121,7 @@ updateHandle(view, -1); | ||
function handleMouseDown(view, event, cellMinWidth) { | ||
let pluginState = key.getState(view.state); | ||
const pluginState = key.getState(view.state); | ||
if (pluginState.activeHandle === -1 || pluginState.dragging) { | ||
return false; | ||
} | ||
let $cell = view.state.doc.resolve(pluginState.activeHandle); | ||
const $cell = view.state.doc.resolve(pluginState.activeHandle); | ||
const row = $cell.parent; | ||
@@ -132,5 +134,5 @@ const cellIndex = $cell.index(); | ||
const tableNode = $cell.node($cell.depth - 1); | ||
let dom = view.domAtPos(pluginState.activeHandle); | ||
let domCell = dom.node.childNodes[dom.offset]; | ||
let tableDom = domCell.closest('table'); | ||
const dom = view.domAtPos(pluginState.activeHandle); | ||
const domCell = dom.node.childNodes[dom.offset]; | ||
const tableDom = domCell.closest('table'); | ||
let col, tableAttrs; | ||
@@ -160,3 +162,3 @@ if (tableNode.attrs[colgroupAttr]) { | ||
} | ||
let width = parseFloat(col.style.width); | ||
const width = parseFloat(col.style.width); | ||
const tr = view.state.tr.setMeta(key, { setDragging: { startX: event.clientX, startWidth: width } }); | ||
@@ -178,6 +180,6 @@ if (!tableDom.style.width) { | ||
ev.view.removeEventListener('mousemove', move); | ||
let curPluginState = key.getState(view.state); | ||
const curPluginState = key.getState(view.state); | ||
if (curPluginState.dragging) { | ||
const transaction = view.state.tr; | ||
updateColumnWidth(view, transaction, curPluginState.activeHandle, draggedWidth(curPluginState.dragging, ev, cellMinWidth)); | ||
updateColumnWidth(view, transaction, curPluginState.activeHandle); | ||
view.dispatch(transaction.setMeta(key, { setDragging: null })); | ||
@@ -190,5 +192,5 @@ } | ||
} | ||
let curPluginState = key.getState(view.state); | ||
let dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth); | ||
displayColumnWidth(view, curPluginState.activeHandle, dragged, cellMinWidth); | ||
const curPluginState = key.getState(view.state); | ||
const dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth); | ||
displayColumnWidth(view, curPluginState.activeHandle, dragged); | ||
} | ||
@@ -201,3 +203,3 @@ event.view.addEventListener('mouseup', finish); | ||
function draggedWidth(dragging, event, cellMinWidth) { | ||
let offset = event.clientX - dragging.startX; | ||
const offset = event.clientX - dragging.startX; | ||
return Math.max(cellMinWidth, dragging.startWidth + offset); | ||
@@ -211,5 +213,5 @@ } | ||
} | ||
function updateColumnWidth(view, tr, cell, _width) { | ||
let $cell = view.state.doc.resolve(cell); | ||
let tableNode = $cell.node(-1), start = $cell.start(-1); | ||
function updateColumnWidth(view, tr, cell) { | ||
const $cell = view.state.doc.resolve(cell); | ||
const tableNode = $cell.node(-1), start = $cell.start(-1); | ||
const tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1; | ||
@@ -228,6 +230,6 @@ const tableDom = view.nodeDOM(start).closest('table'); | ||
} | ||
function displayColumnWidth(view, cell, width, _cellMinWidth) { | ||
let $cell = view.state.doc.resolve(cell); | ||
let table = $cell.node(-1), start = $cell.start(-1); | ||
let col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1; | ||
function displayColumnWidth(view, cell, width) { | ||
const $cell = view.state.doc.resolve(cell); | ||
const table = $cell.node(-1), start = $cell.start(-1); | ||
const col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1; | ||
let dom = view.domAtPos($cell.start(-1)).node; | ||
@@ -250,5 +252,5 @@ if (dom.nodeName !== 'TABLE') { | ||
function handleDecorations(state, cell) { | ||
let decorations = []; | ||
let $cell = state.doc.resolve(cell); | ||
let table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1); | ||
const decorations = []; | ||
const $cell = state.doc.resolve(cell); | ||
const table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1); | ||
const cellsPositions = []; | ||
@@ -265,3 +267,3 @@ const cellPos = cell - start; | ||
cellsPositions.forEach((row) => { | ||
let c = row[column]; | ||
const c = row[column]; | ||
if (row[column] !== row[column + 1]) { | ||
@@ -272,4 +274,4 @@ cells.push(c); | ||
cells.forEach((cPos => { | ||
let pos = start + cPos + table.nodeAt(cPos).nodeSize - 1; | ||
let dom = document.createElement('div'); | ||
const pos = start + cPos + table.nodeAt(cPos).nodeSize - 1; | ||
const dom = document.createElement('div'); | ||
dom.className = 'column-resize-handle'; | ||
@@ -276,0 +278,0 @@ decorations.push(Decoration.widget(pos, dom)); |
@@ -13,7 +13,7 @@ import { Plugin } from 'prosemirror-state'; | ||
const handleWidth = 5; | ||
let plugin = new Plugin({ | ||
const plugin = new Plugin({ | ||
key, | ||
state: { | ||
init(_, state) { | ||
this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] = (_node, _view) => new TableRowView(); | ||
this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] = () => new TableRowView(); | ||
return new ResizeState(-1, null); | ||
@@ -30,3 +30,3 @@ }, | ||
} | ||
let pluginState = key.getState(state); | ||
const pluginState = key.getState(state); | ||
return pluginState.activeHandle > -1 ? { class: 'resize-cursor-vertical' } : null; | ||
@@ -53,3 +53,3 @@ }, | ||
} | ||
let pluginState = key.getState(state); | ||
const pluginState = key.getState(state); | ||
if (pluginState.activeHandle > -1) { | ||
@@ -73,3 +73,3 @@ return handleDecorations(state, pluginState.activeHandle); | ||
apply(tr) { | ||
let state = this, action = tr.getMeta(key); | ||
let state, action = tr.getMeta(key); | ||
if (action && action.setHandle != null) { | ||
@@ -79,16 +79,16 @@ return new ResizeState(action.setHandle, null); | ||
if (action && action.setDragging !== undefined) { | ||
return new ResizeState(state.activeHandle, action.setDragging); | ||
return new ResizeState(this.activeHandle, action.setDragging); | ||
} | ||
if (state.activeHandle > -1) { | ||
let handle = tr.mapping.map(state.activeHandle, -1); | ||
if (this.activeHandle > -1) { | ||
let handle = tr.mapping.map(this.activeHandle, -1); | ||
if (!pointsAtCell(tr.doc.resolve(handle))) { | ||
handle = null; | ||
} | ||
state = new ResizeState(handle, state.dragging); | ||
state = new ResizeState(handle, this.dragging); | ||
} | ||
return state; | ||
return state || this; | ||
} | ||
} | ||
function handleMouseMove(view, event, handleWidth) { | ||
let pluginState = key.getState(view.state); | ||
const pluginState = key.getState(view.state); | ||
if (!pluginState.dragging) { | ||
@@ -98,3 +98,3 @@ let target = domCellAround(event.target), cell = -1; | ||
const indexes = cellIndexes(target); | ||
let { top, bottom } = target.getBoundingClientRect(); | ||
const { top, bottom } = target.getBoundingClientRect(); | ||
if (Math.abs(event.clientY - top) <= handleWidth && indexes.rowIndex > 0) { | ||
@@ -114,3 +114,3 @@ indexes.rowIndex -= target.rowSpan; | ||
function handleMouseLeave(view) { | ||
let pluginState = key.getState(view.state); | ||
const pluginState = key.getState(view.state); | ||
if (pluginState.activeHandle > -1 && !pluginState.dragging) { | ||
@@ -121,3 +121,3 @@ updateHandle(view, -1); | ||
function handleMouseDown(view, event) { | ||
let pluginState = key.getState(view.state); | ||
const pluginState = key.getState(view.state); | ||
if (pluginState.activeHandle === -1 || pluginState.dragging) { | ||
@@ -127,7 +127,7 @@ return false; | ||
const doc = view.state.doc; | ||
let $cell = doc.resolve(pluginState.activeHandle); | ||
let row = $cell.parent; | ||
let table = $cell.node(-1); | ||
let rowHeightStr = parseStyle(row.attrs.style).height; | ||
let tableHeight = parseStyle(table.attrs.style).height; | ||
const $cell = doc.resolve(pluginState.activeHandle); | ||
const row = $cell.parent; | ||
const table = $cell.node(-1); | ||
const rowHeightStr = parseStyle(row.attrs.style).height; | ||
const tableHeight = parseStyle(table.attrs.style).height; | ||
let rowHeight = rowHeightStr ? parseFloat(rowHeightStr) : 0; | ||
@@ -147,3 +147,3 @@ if (!rowHeightStr) { | ||
ev.view.removeEventListener('mousemove', move); | ||
let curPluginState = key.getState(view.state); | ||
const curPluginState = key.getState(view.state); | ||
if (curPluginState.dragging) { | ||
@@ -159,5 +159,5 @@ const tr = view.state.tr.setMeta(key, { setDragging: null }); | ||
} | ||
let curPluginState = key.getState(view.state); | ||
let dragged = draggedHeight(curPluginState.dragging, ev); | ||
let offset = ev.clientY - curPluginState.dragging.startY; | ||
const curPluginState = key.getState(view.state); | ||
const dragged = draggedHeight(curPluginState.dragging, ev); | ||
const offset = ev.clientY - curPluginState.dragging.startY; | ||
displayRowHeight(view, curPluginState.activeHandle, dragged, offset, tableHeight); | ||
@@ -192,4 +192,4 @@ } | ||
if (tableHeight) { | ||
let $pos = doc.resolve(rowPos); | ||
let tablePos = $pos.start($pos.depth) - 1; | ||
const $pos = doc.resolve(rowPos); | ||
const tablePos = $pos.start($pos.depth) - 1; | ||
tr.setNodeMarkup(tablePos, null, setNodeStyle($pos.parent.attrs, 'height', tableHeight)); | ||
@@ -237,4 +237,4 @@ } | ||
const cellNode = table.nodeAt(cPos); | ||
let widgetPos = start + cPos + (cellNode ? cellNode.nodeSize : 0) - 1; | ||
let dom = document.createElement('div'); | ||
const widgetPos = start + cPos + (cellNode ? cellNode.nodeSize : 0) - 1; | ||
const dom = document.createElement('div'); | ||
dom.className = 'row-resize-handle'; | ||
@@ -241,0 +241,0 @@ decorations.push(Decoration.widget(widgetPos, dom)); |
@@ -21,3 +21,3 @@ import { NodeSelection, Plugin } from 'prosemirror-state'; | ||
apply(tr) { | ||
let state = this, next = tr.getMeta(key); | ||
const next = tr.getMeta(key); | ||
if (next) { | ||
@@ -27,3 +27,3 @@ const nextState = new ResizeState(next.activeHandle, next.setDragging, next.nodePosition); | ||
} | ||
return state; | ||
return this; | ||
} | ||
@@ -38,3 +38,3 @@ } | ||
} | ||
let tableDom = getTable(view.nodeDOM(nodePosition)); | ||
const tableDom = getTable(view.nodeDOM(nodePosition)); | ||
const rect = tableDom.getBoundingClientRect(); | ||
@@ -121,3 +121,3 @@ const dir = directions[activeHandle]; | ||
}); | ||
let tableAttrs = Object.assign({}, attrs); | ||
const tableAttrs = Object.assign({}, attrs); | ||
if (widthChanged) { | ||
@@ -199,3 +199,3 @@ tableAttrs[colgroupAttr] = colgroup.outerHTML; | ||
} | ||
function finish(_e) { | ||
function finish() { | ||
curWindow.removeEventListener('mouseup', finish); | ||
@@ -212,3 +212,3 @@ curWindow.removeEventListener('mousemove', move); | ||
key: key, | ||
view: (_viewObj) => ({ | ||
view: () => ({ | ||
selectedNode(state, nodeType) { | ||
@@ -215,0 +215,0 @@ const selection = state.selection; |
@@ -72,3 +72,3 @@ import { colgroupAttr, dataResizeDirTable, resizableAttr, resizableWrap, resizeHandle } from '../../config/constants'; | ||
const skip = [colgroupAttr, resizableAttr]; | ||
for (let attrName in attrs) { | ||
for (const attrName in attrs) { | ||
if (attrName && skip.indexOf(attrName) === -1) { | ||
@@ -111,3 +111,3 @@ setAttribute(table, attrName, attrs[attrName]); | ||
setAttributes(dom, attrs) { | ||
for (let attrName in attrs) { | ||
for (const attrName in attrs) { | ||
if (attrName) { | ||
@@ -114,0 +114,0 @@ setAttribute(dom, attrName, attrs[attrName]); |
@@ -172,2 +172,3 @@ import { DOMParser as ProseMirrorDOMParser } from 'prosemirror-model'; | ||
* Creates a DocumentFragment from the given ProseMirrorNode. | ||
* | ||
* @param doc ProseMirrorNode | ||
@@ -174,0 +175,0 @@ * @returns DocumentFragment |
@@ -6,2 +6,3 @@ import { addRowAfter as pmAddRowAfter, addRowBefore as pmAddRowBefore, addColumnBefore as pmAddColumnBefore, addColumnAfter as pmAddColumnAfter, deleteColumn as pmDeleteColumn, TableMap } from 'prosemirror-tables'; | ||
* Creates a table. | ||
* | ||
* @returns Node | ||
@@ -8,0 +9,0 @@ */ |
@@ -43,5 +43,5 @@ import { Node, Fragment } from 'prosemirror-model'; | ||
export const canInsert = (state, nodeType) => { | ||
let $from = state.selection.$from; | ||
const $from = state.selection.$from; | ||
for (let d = $from.depth; d >= 0; d--) { | ||
let index = $from.index(d); | ||
const index = $from.index(d); | ||
if ($from.node(d).canReplaceWith(index, index, nodeType)) { | ||
@@ -77,3 +77,3 @@ return true; | ||
for (let depth = pos.depth; depth > 0; depth--) { | ||
let node = pos.node(depth); | ||
const node = pos.node(depth); | ||
if (predicate(node)) { | ||
@@ -87,3 +87,3 @@ return { node, depth }; | ||
const result = {}; | ||
for (let attr in attrs) { | ||
for (const attr in attrs) { | ||
if (attr && (attrs[attr] || attrs[attr] === 0)) { | ||
@@ -251,3 +251,3 @@ result[attr] = attrs[attr]; | ||
export const expandToWordWrap = (command, options) => { | ||
return (state, dispatch, _view) => { | ||
return (state, dispatch) => { | ||
const { state: cmdState, dispatch: cmdDispatch } = expandSelection(state, dispatch, options); | ||
@@ -275,3 +275,3 @@ return command(options)(cmdState, cmdDispatch); | ||
const styles = parseStyle(styleString); | ||
for (let style in styles) { | ||
for (const style in styles) { | ||
if (style && typeof element.style[style] !== 'undefined') { | ||
@@ -278,0 +278,0 @@ element.style[style] = styles[style]; |
@@ -11,3 +11,3 @@ "use strict"; | ||
var alignBlocks = function (actions, commandName) { return function (state, dispatch) { | ||
var blocks = blockNode_1.blockNodes(state); | ||
var blocks = (0, blockNode_1.blockNodes)(state); | ||
var tr = state.tr; | ||
@@ -19,4 +19,4 @@ tr.setMeta('commandName', commandName); | ||
if (action) { | ||
var newAttrs = blockNode_1.addStyles(node, action.style); | ||
blockNode_1.changeTextBlock(tr, node, node.type, newAttrs); | ||
var newAttrs = (0, blockNode_1.addStyles)(node, action.style); | ||
(0, blockNode_1.changeTextBlock)(tr, node, node.type, newAttrs); | ||
} | ||
@@ -33,3 +33,3 @@ } | ||
var isAligned = function (state, actions) { | ||
var blocks = blockNode_1.blockNodes(state); | ||
var blocks = (0, blockNode_1.blockNodes)(state); | ||
var result = false; | ||
@@ -41,3 +41,3 @@ blocks.forEach(function (node) { | ||
result = action.style.every(function (style) { | ||
return !!style.value && new RegExp(style.name + ":\\s?" + style.value, 'i').test(node.attrs.style); | ||
return !!style.value && new RegExp("".concat(style.name, ":\\s?").concat(style.value), 'i').test(node.attrs.style); | ||
}); | ||
@@ -44,0 +44,0 @@ } |
@@ -78,3 +78,3 @@ "use strict"; | ||
var to = range.$to.pos; | ||
doc.nodesBetween(from, to, function (node, pos, _parent, _index) { | ||
doc.nodesBetween(from, to, function (node, pos) { | ||
if (node.isBlock && (!blocksInSelection || (pos >= from && pos + node.content.size + 2 <= to))) { | ||
@@ -91,3 +91,3 @@ result.push(node); | ||
return function (state, dispatch) { | ||
var blocks = exports.blockNodes(state); | ||
var blocks = (0, exports.blockNodes)(state); | ||
var nodes = state.schema.nodes; | ||
@@ -100,12 +100,10 @@ var tr = state.tr; | ||
if (value === 'p') { | ||
var _a = node.attrs, level = _a.level, attrs = tslib_1.__rest(_a, ["level"]); | ||
exports.changeTextBlock(tr, node, nodes.paragraph, attrs); | ||
(0, exports.changeTextBlock)(tr, node, nodes.paragraph, node.attrs); | ||
} | ||
else if (/^h[1-6]$/i.test(value)) { | ||
var level = parseInt(value.substr(1), 10); | ||
exports.changeTextBlock(tr, node, nodes.heading, tslib_1.__assign(tslib_1.__assign({}, node.attrs), { level: level })); | ||
(0, exports.changeTextBlock)(tr, node, nodes.heading, tslib_1.__assign(tslib_1.__assign({}, node.attrs), { level: level })); | ||
} | ||
else if (value === 'blockquote') { | ||
var _b = node.attrs, level = _b.level, attrs = tslib_1.__rest(_b, ["level"]); | ||
exports.changeTextBlock(tr, node, nodes.blockquote, attrs); | ||
(0, exports.changeTextBlock)(tr, node, nodes.blockquote, node.attrs); | ||
} | ||
@@ -133,3 +131,3 @@ } | ||
var blocksInSelection = options.blocksInSelection, blockNodeType = options.blockNodeType; | ||
var nodes = exports.blockNodes({ doc: doc, selection: selection }, { blocksInSelection: blocksInSelection }); | ||
var nodes = (0, exports.blockNodes)({ doc: doc, selection: selection }, { blocksInSelection: blocksInSelection }); | ||
var textBlocks = nodes.filter(function (node) { return node.isTextblock; }); | ||
@@ -140,3 +138,3 @@ textBlocks.forEach(function (node) { | ||
if (style || className || nodeType !== node.type) { | ||
exports.changeTextBlock(tr, node, nodeType, attrs); | ||
(0, exports.changeTextBlock)(tr, node, nodeType, attrs); | ||
} | ||
@@ -147,3 +145,3 @@ }); | ||
var getBlockFormats = function (state) { | ||
var blocks = exports.blockNodes(state); | ||
var blocks = (0, exports.blockNodes)(state); | ||
var nodes = state.schema.nodes; | ||
@@ -156,3 +154,3 @@ var result = []; | ||
else if (node.type === nodes.heading) { | ||
result.push("h" + node.attrs.level); | ||
result.push("h".concat(node.attrs.level)); | ||
} | ||
@@ -172,7 +170,7 @@ else if (node.type === nodes.blockquote && nodes.blockquote.isTextblock) { | ||
toChange = { style: style.name, value: /^.+$/, newValue: style.value }; | ||
changedStyleResult = utils_1.changeStylesString(currentStyles, toChange); | ||
changedStyleResult = (0, utils_1.changeStylesString)(currentStyles, toChange); | ||
currentStyles = changedStyleResult.changed ? changedStyleResult.style : currentStyles; | ||
}); | ||
} | ||
var reducer = function (acc, curr) { return ((acc && curr.value ? acc + ' ' : '') + curr.value ? curr.name + ": " + curr.value + ";" : ''); }; | ||
var reducer = function (acc, curr) { return ((acc && curr.value ? acc + ' ' : '') + curr.value ? "".concat(curr.name, ": ").concat(curr.value, ";") : ''); }; | ||
currentStyles = currentStyles || stylesToApply.reduce(reducer, ''); | ||
@@ -193,3 +191,3 @@ return Object.assign({}, node.attrs, { style: currentStyles || null }); | ||
var parentBlockFormat = function (state) { | ||
var formats = exports.getBlockFormats(state); | ||
var formats = (0, exports.getBlockFormats)(state); | ||
return new Set(formats).size === 1 ? formats[0] : null; | ||
@@ -202,4 +200,4 @@ }; | ||
var activeNode = function (state) { | ||
return { tag: exports.parentBlockFormat(state) || '' }; | ||
return { tag: (0, exports.parentBlockFormat)(state) || '' }; | ||
}; | ||
exports.activeNode = activeNode; |
@@ -6,3 +6,3 @@ "use strict"; | ||
var blockquote = function (state, dispatch) { | ||
return prosemirror_commands_1.wrapIn(state.schema.nodes.blockquote)(state, dispatch); | ||
return (0, prosemirror_commands_1.wrapIn)(state.schema.nodes.blockquote)(state, dispatch); | ||
}; | ||
@@ -17,3 +17,3 @@ exports.blockquote = blockquote; | ||
if (range) { | ||
doc.nodesBetween(range.start, range.end, function (node, pos, _parent, _index) { | ||
doc.nodesBetween(range.start, range.end, function (node, pos) { | ||
if (node.type === nodeType) { | ||
@@ -20,0 +20,0 @@ target = pos; |
@@ -15,4 +15,4 @@ "use strict"; | ||
var except = (exceptMarks || [state.schema.marks.link]).filter(Boolean); | ||
mark_1.cleanMarks(tr, { except: except }); | ||
blockNode_1.cleanTextBlockFormatting(tr, { blocksInSelection: blocksInSelection, blockNodeType: blockNodeType }); | ||
(0, mark_1.cleanMarks)(tr, { except: except }); | ||
(0, blockNode_1.cleanTextBlockFormatting)(tr, { blocksInSelection: blocksInSelection, blockNodeType: blockNodeType }); | ||
var result = tr.docChanged; | ||
@@ -19,0 +19,0 @@ if (result && dispatch) { |
@@ -20,5 +20,5 @@ "use strict"; | ||
// tslint:disable-next-line:no-string-literal | ||
keys['Backspace'] = prosemirror_commands_1.chainCommands(prosemirror_inputrules_1.undoInputRule, prosemirror_commands_1.deleteSelection, prosemirror_commands_1.joinBackward, prosemirror_commands_1.selectNodeBackward); | ||
keys.Backspace = (0, prosemirror_commands_1.chainCommands)(prosemirror_inputrules_1.undoInputRule, prosemirror_commands_1.deleteSelection, prosemirror_commands_1.joinBackward, prosemirror_commands_1.selectNodeBackward); | ||
// tslint:disable-next-line:no-string-literal | ||
keys['Enter'] = prosemirror_commands_1.chainCommands(prosemirror_commands_1.newlineInCode, prosemirror_commands_1.createParagraphNear, prosemirror_commands_1.liftEmptyBlock, prosemirror_commands_1.splitBlockKeepMarks); | ||
keys.Enter = (0, prosemirror_commands_1.chainCommands)(prosemirror_commands_1.newlineInCode, prosemirror_commands_1.createParagraphNear, prosemirror_commands_1.liftEmptyBlock, prosemirror_commands_1.splitBlockKeepMarks); | ||
if (!mac) { | ||
@@ -28,13 +28,13 @@ keys['Mod-y'] = prosemirror_history_1.redo; | ||
if (schema.marks.strong) { | ||
keys['Mod-b'] = utils_1.expandToWordWrap(inline_style_1.toggleInlineFormat, tslib_1.__assign(tslib_1.__assign({}, commands_1.bold), { applyToWord: applyToWord })); | ||
keys['Mod-b'] = (0, utils_1.expandToWordWrap)(inline_style_1.toggleInlineFormat, tslib_1.__assign(tslib_1.__assign({}, commands_1.bold), { applyToWord: applyToWord })); | ||
} | ||
if (schema.marks.em) { | ||
keys['Mod-i'] = utils_1.expandToWordWrap(inline_style_1.toggleInlineFormat, tslib_1.__assign(tslib_1.__assign({}, commands_1.italic), { applyToWord: applyToWord })); | ||
keys['Mod-i'] = (0, utils_1.expandToWordWrap)(inline_style_1.toggleInlineFormat, tslib_1.__assign(tslib_1.__assign({}, commands_1.italic), { applyToWord: applyToWord })); | ||
} | ||
if (schema.marks.u) { | ||
keys['Mod-u'] = utils_1.expandToWordWrap(inline_style_1.toggleInlineFormat, tslib_1.__assign(tslib_1.__assign({}, commands_1.underline), { applyToWord: applyToWord })); | ||
keys['Mod-u'] = (0, utils_1.expandToWordWrap)(inline_style_1.toggleInlineFormat, tslib_1.__assign(tslib_1.__assign({}, commands_1.underline), { applyToWord: applyToWord })); | ||
} | ||
if (schema.nodes.hard_break) { | ||
var br_1 = schema.nodes.hard_break; | ||
var cmd = prosemirror_commands_1.chainCommands(prosemirror_commands_1.exitCode, function (state, dispatch) { | ||
var cmd = (0, prosemirror_commands_1.chainCommands)(prosemirror_commands_1.exitCode, function (state, dispatch) { | ||
dispatch(state.tr.replaceSelectionWith(br_1.create()).scrollIntoView()); | ||
@@ -52,3 +52,3 @@ return true; | ||
// tslint:disable-next-line:no-string-literal | ||
keys['Enter'] = lists_1.splitListItemKeepMarks(schema.nodes.list_item); | ||
keys.Enter = (0, lists_1.splitListItemKeepMarks)(schema.nodes.list_item); | ||
} | ||
@@ -55,0 +55,0 @@ return keys; |
@@ -14,3 +14,4 @@ "use strict"; | ||
var result = {}; | ||
var attributes = dom.attributes, attr; | ||
var attributes = dom.attributes; | ||
var attr; | ||
for (var i = 0; i < attributes.length; i++) { | ||
@@ -122,4 +123,4 @@ attr = attributes[i]; | ||
var parseStrColgroup = function (colgroup) { | ||
var doc = source_1.domToPmDoc(source_1.htmlToFragment(colgroup), colgroupSchema, { preserveWhitespace: false }); | ||
var fragment = source_1.pmDocToFragment(doc); | ||
var doc = (0, source_1.domToPmDoc)((0, source_1.htmlToFragment)(colgroup), colgroupSchema, { preserveWhitespace: false }); | ||
var fragment = (0, source_1.pmDocToFragment)(doc); | ||
var colgroupEl = fragment.firstChild; | ||
@@ -129,3 +130,3 @@ return colgroupEl; | ||
exports.parseStrColgroup = parseStrColgroup; | ||
var tNodes = prosemirror_tables_1.tableNodes({ tableGroup: 'block', cellContent: 'block+', cellAttributes: cellAttributes }); | ||
var tNodes = (0, prosemirror_tables_1.tableNodes)({ tableGroup: 'block', cellContent: 'block+', cellAttributes: cellAttributes }); | ||
tNodes.table_row.attrs = tslib_1.__assign(tslib_1.__assign({}, tNodes.table_row.attrs), defaultAttrs([constants_1.rowTypeAttr, 'style', 'class', 'id'])); | ||
@@ -139,3 +140,3 @@ tNodes.table_row.toDOM = function (node) { return ['tr', pmAttributes(node.attrs), 0]; }; | ||
if (node.attrs[constants_1.colgroupAttr] && !shouldSkipColgroup(node)) { | ||
var colgroupEl = exports.parseStrColgroup(node.attrs[constants_1.colgroupAttr]); | ||
var colgroupEl = (0, exports.parseStrColgroup)(node.attrs[constants_1.colgroupAttr]); | ||
if (colgroupEl) { | ||
@@ -142,0 +143,0 @@ var cols = Array.from(colgroupEl.children).map(function (c) { return ['col', domAttributes(c)]; }); |
@@ -1,3 +0,3 @@ | ||
import { DOMOutputSpec, Fragment, Mark, Node, Schema } from "prosemirror-model"; | ||
declare type DOMNode = InstanceType<typeof window.Node>; | ||
import { DOMOutputSpec, Fragment, Mark, Node, Schema } from 'prosemirror-model'; | ||
type DOMNode = InstanceType<typeof window.Node>; | ||
export declare class DOMSerializer { | ||
@@ -4,0 +4,0 @@ readonly nodes: { |
@@ -26,3 +26,3 @@ "use strict"; | ||
if (xmlNS === void 0) { xmlNS = null; } | ||
if (typeof structure === "string") { | ||
if (typeof structure === 'string') { | ||
return { dom: docum.createTextNode(structure) }; | ||
@@ -36,3 +36,3 @@ } | ||
} | ||
var tagName = structure[0], space = tagName.indexOf(" "); | ||
var tagName = structure[0], space = tagName.indexOf(' '); | ||
if (space > 0) { | ||
@@ -45,7 +45,7 @@ xmlNS = tagName.slice(0, space); | ||
var attrs = structure[1], start = 1; | ||
if (attrs && typeof attrs === "object" && attrs.nodeType == null && !Array.isArray(attrs)) { | ||
if (attrs && typeof attrs === 'object' && attrs.nodeType == null && !Array.isArray(attrs)) { | ||
start = 2; | ||
for (var name_1 in attrs) { | ||
if (attrs[name_1] != null) { | ||
space = name_1.indexOf(" "); | ||
space = name_1.indexOf(' '); | ||
if (space > 0) { | ||
@@ -55,3 +55,3 @@ dom.setAttributeNS(name_1.slice(0, space), name_1.slice(space + 1), attrs[name_1]); | ||
else { | ||
utils_1.setAttribute(dom, name_1, attrs[name_1]); | ||
(0, utils_1.setAttribute)(dom, name_1, attrs[name_1]); | ||
} | ||
@@ -65,3 +65,3 @@ } | ||
if (i < structure.length - 1 || i > start) { | ||
throw new RangeError("Content hole must be the only child of its parent node"); | ||
throw new RangeError('Content hole must be the only child of its parent node'); | ||
} | ||
@@ -75,3 +75,3 @@ return { dom: dom, contentDOM: dom }; | ||
if (contentDOM) { | ||
throw new RangeError("Multiple content holes"); | ||
throw new RangeError('Multiple content holes'); | ||
} | ||
@@ -174,3 +174,3 @@ contentDOM = innerContent; | ||
if (node.isLeaf) { | ||
throw new RangeError("Content hole not allowed in a leaf node spec"); | ||
throw new RangeError('Content hole not allowed in a leaf node spec'); | ||
} | ||
@@ -177,0 +177,0 @@ this.serializeFragment(node.content, options, contentDOM); |
@@ -20,3 +20,3 @@ "use strict"; | ||
var regExp = useRegExp ? new RegExp(searchText, flags) : createRegExp(searchText, flags); | ||
doc.nodesBetween(start, end, function (node, pos, _parent) { | ||
doc.nodesBetween(start, end, function (node, pos) { | ||
if (exit(result)) { | ||
@@ -70,11 +70,11 @@ return false; | ||
if (backward) { | ||
result = exports.findAt(doc, options, 0, selection.from, exit); | ||
result = (0, exports.findAt)(doc, options, 0, selection.from, exit); | ||
if (!result.length && matchCyclic) { | ||
result = exports.findAt(doc, options, selection.from, doc.content.size, exit); | ||
result = (0, exports.findAt)(doc, options, selection.from, doc.content.size, exit); | ||
} | ||
} | ||
else { | ||
result = exports.findAt(doc, options, selection.to, doc.content.size, exit); | ||
result = (0, exports.findAt)(doc, options, selection.to, doc.content.size, exit); | ||
if (!result.length && matchCyclic) { | ||
result = exports.findAt(doc, options, 0, selection.to, exit); | ||
result = (0, exports.findAt)(doc, options, 0, selection.to, exit); | ||
} | ||
@@ -86,3 +86,3 @@ } | ||
var findAll = function (doc, searchOptions) { | ||
return exports.findAt(doc, searchOptions, 0, doc.content.size, function () { return false; }); | ||
return (0, exports.findAt)(doc, searchOptions, 0, doc.content.size, function () { return false; }); | ||
}; | ||
@@ -98,3 +98,3 @@ exports.findAll = findAll; | ||
var replaceAll = function (state, replaceText, searchOptions) { | ||
var result = exports.findAll(state.doc, searchOptions); | ||
var result = (0, exports.findAll)(state.doc, searchOptions); | ||
if (result.length === 0) { | ||
@@ -101,0 +101,0 @@ return null; |
@@ -9,4 +9,4 @@ "use strict"; | ||
var newImage = image.createAndFill(attrs); | ||
utils_1.insertNode(newImage)(state, function (tr) { return dispatch(tr.setMeta('commandName', commandName).setMeta('args', attrs)); }); | ||
(0, utils_1.insertNode)(newImage)(state, function (tr) { return dispatch(tr.setMeta('commandName', commandName).setMeta('args', attrs)); }); | ||
}; }; | ||
exports.insertImage = insertImage; |
@@ -15,3 +15,3 @@ "use strict"; | ||
var indentBlocks = function (actions, command, dir) { return function (state, dispatch) { | ||
var blocks = blockNode_1.blockNodes(state); | ||
var blocks = (0, blockNode_1.blockNodes)(state); | ||
var tr = state.tr; | ||
@@ -27,6 +27,6 @@ tr.setMeta('commandName', command); | ||
name: style, | ||
value: action.step > 0 ? "" + action.step + action.unit : '' | ||
value: action.step > 0 ? "".concat(action.step).concat(action.unit) : '' | ||
}; | ||
if (node.attrs.style) { | ||
var re = new RegExp(style + ":\\s?(\\d+)" + action.unit, 'i'); | ||
var re = new RegExp("".concat(style, ":\\s?(\\d+)").concat(action.unit), 'i'); | ||
var match = node.attrs.style.match(re); | ||
@@ -36,9 +36,9 @@ if (match) { | ||
newMargin = newMargin <= 0 ? '' : newMargin; | ||
newStyle.value = "" + newMargin + (newMargin ? action.unit : ''); | ||
newStyle.value = "".concat(newMargin).concat(newMargin ? action.unit : ''); | ||
} | ||
} | ||
newAttrs = blockNode_1.addStyles(node, [newStyle]); | ||
newAttrs = (0, blockNode_1.addStyles)(node, [newStyle]); | ||
} | ||
if (newAttrs) { | ||
blockNode_1.changeTextBlock(tr, node, node.type, newAttrs); | ||
(0, blockNode_1.changeTextBlock)(tr, node, node.type, newAttrs); | ||
} | ||
@@ -55,3 +55,3 @@ } | ||
var isIndented = function (state, rules, dir) { | ||
var blocks = blockNode_1.blockNodes(state); | ||
var blocks = (0, blockNode_1.blockNodes)(state); | ||
var result = false; | ||
@@ -63,3 +63,3 @@ blocks.forEach(function (node) { | ||
var style = dir === 'rtl' ? action.rtlStyle : action.style; | ||
var reIndent = new RegExp(style + ":\\s?\\d+" + action.unit, 'i'); | ||
var reIndent = new RegExp("".concat(style, ":\\s?\\d+").concat(action.unit), 'i'); | ||
result = reIndent.test(node.attrs.style); | ||
@@ -73,3 +73,3 @@ } | ||
var canIndentAsListItem = function (state, nodeType) { | ||
return prosemirror_schema_list_1.sinkListItem(nodeType)(state); | ||
return (0, prosemirror_schema_list_1.sinkListItem)(nodeType)(state); | ||
}; | ||
@@ -81,5 +81,5 @@ exports.canIndentAsListItem = canIndentAsListItem; | ||
var bulletList = state.schema.nodes[rules.listsTypes.bulletList]; | ||
var isNestedInOL = !!utils_1.findNthParentNodeOfType(orderedList, 2)(state.selection); | ||
var isNestedInUL = !!utils_1.findNthParentNodeOfType(bulletList, 2)(state.selection); | ||
return (isNestedInOL || isNestedInUL) && prosemirror_schema_list_1.liftListItem(listItem)(state); | ||
var isNestedInOL = !!(0, utils_1.findNthParentNodeOfType)(orderedList, 2)(state.selection); | ||
var isNestedInUL = !!(0, utils_1.findNthParentNodeOfType)(bulletList, 2)(state.selection); | ||
return (isNestedInOL || isNestedInUL) && (0, prosemirror_schema_list_1.liftListItem)(listItem)(state); | ||
}; | ||
@@ -90,4 +90,4 @@ exports.canOutdentAsListItem = canOutdentAsListItem; | ||
var listItem = nodes[indent_rules_1.indentRules.listsTypes.listItem]; | ||
return ((exports.isIndented(state, rules.nodes) || indent_rules_1.indentRules.nodes.some(function (rule) { return nodes[rule.node] && blockNode_1.hasNode(state, nodes[rule.node]); })) && | ||
!blockNode_1.hasNode(state, listItem)); | ||
return (((0, exports.isIndented)(state, rules.nodes) || indent_rules_1.indentRules.nodes.some(function (rule) { return nodes[rule.node] && (0, blockNode_1.hasNode)(state, nodes[rule.node]); })) && | ||
!(0, blockNode_1.hasNode)(state, listItem)); | ||
}; | ||
@@ -97,8 +97,8 @@ exports.canBeIndented = canBeIndented; | ||
var listItem = state.schema.nodes[indent_rules_1.indentRules.listsTypes.listItem]; | ||
var isIndentableBlock = exports.canBeIndented(state, indent_rules_1.indentRules); | ||
if (exports.canIndentAsListItem(state, listItem)) { | ||
prosemirror_schema_list_1.sinkListItem(listItem)(state, dispatch); | ||
var isIndentableBlock = (0, exports.canBeIndented)(state, indent_rules_1.indentRules); | ||
if ((0, exports.canIndentAsListItem)(state, listItem)) { | ||
(0, prosemirror_schema_list_1.sinkListItem)(listItem)(state, dispatch); | ||
} | ||
else if (isIndentableBlock) { | ||
exports.indentBlocks(indent_rules_1.indentRules.nodes)(state, dispatch); | ||
(0, exports.indentBlocks)(indent_rules_1.indentRules.nodes)(state, dispatch); | ||
} | ||
@@ -110,13 +110,13 @@ }; | ||
var listItem = nodes[indent_rules_1.outdentRules.listsTypes.listItem]; | ||
var isIndentableBlock = exports.canBeIndented(state, indent_rules_1.outdentRules); | ||
if (blockNode_1.hasNode(state, nodes.blockquote)) { | ||
blockquote_1.liftBlockquote(state, dispatch); | ||
var isIndentableBlock = (0, exports.canBeIndented)(state, indent_rules_1.outdentRules); | ||
if ((0, blockNode_1.hasNode)(state, nodes.blockquote)) { | ||
(0, blockquote_1.liftBlockquote)(state, dispatch); | ||
} | ||
else if (exports.canOutdentAsListItem(state, indent_rules_1.outdentRules)) { | ||
prosemirror_schema_list_1.liftListItem(listItem)(state, dispatch); | ||
else if ((0, exports.canOutdentAsListItem)(state, indent_rules_1.outdentRules)) { | ||
(0, prosemirror_schema_list_1.liftListItem)(listItem)(state, dispatch); | ||
} | ||
else if (isIndentableBlock) { | ||
exports.indentBlocks(indent_rules_1.outdentRules.nodes)(state, dispatch); | ||
(0, exports.indentBlocks)(indent_rules_1.outdentRules.nodes)(state, dispatch); | ||
} | ||
}; | ||
exports.outdent = outdent; |
@@ -12,3 +12,3 @@ "use strict"; | ||
var elementStyle = styleMark && styleMark.attrs.style; | ||
return utils_1.changeStylesString(elementStyle, toChange); | ||
return (0, utils_1.changeStylesString)(elementStyle, toChange); | ||
}; | ||
@@ -28,3 +28,3 @@ var changeStyleMark = function (tr, from, to, attrs, markType) { | ||
var style = newStyle.changed ? | ||
{ style: newStyle.style || null } : { style: [attrs.style] + ": " + attrs.newValue + ";" }; | ||
{ style: newStyle.style || null } : { style: "".concat([attrs.style], ": ").concat(attrs.newValue, ";") }; | ||
var currentMark = markType.isInSet(marks) ? marks.find(function (m) { return m.type.name === 'style'; }) : null; | ||
@@ -66,4 +66,4 @@ var newMarkAttrs_1 = currentMark ? tslib_1.__assign(tslib_1.__assign({}, currentMark.attrs), style) : style; | ||
var styleMark = state.schema.marks.style; | ||
var marks = styleMark ? mark_1.selectionMarks(state, styleMark) : []; | ||
return marks.map(function (mark) { return mark_1.styleValue(mark, style); }).filter(function (m) { return m !== null; }); | ||
var marks = styleMark ? (0, mark_1.selectionMarks)(state, styleMark) : []; | ||
return marks.map(function (mark) { return (0, mark_1.styleValue)(mark, style); }).filter(function (m) { return m !== null; }); | ||
}; | ||
@@ -75,3 +75,3 @@ exports.getInlineStyles = getInlineStyles; | ||
var $cursor = state.selection instanceof prosemirror_state_1.TextSelection && state.selection.$cursor; | ||
if ((empty && !$cursor) || !mark_1.markApplies(state.doc, ranges, markType)) { | ||
if ((empty && !$cursor) || !(0, mark_1.markApplies)(state.doc, ranges, markType)) { | ||
return false; | ||
@@ -88,3 +88,3 @@ } | ||
var newAttrs_1 = tslib_1.__assign(tslib_1.__assign({}, (styleMark ? styleMark.attrs : {})), { style: newStyle.style || null }); | ||
if (utils_1.shallowEqual(styleMark.attrs, newAttrs_1)) { | ||
if ((0, utils_1.shallowEqual)(styleMark.attrs, newAttrs_1)) { | ||
return false; | ||
@@ -127,10 +127,10 @@ } | ||
} | ||
var allMarks = tslib_1.__spreadArray([mark], altMarks).filter(function (m) { return marks[m]; }); | ||
var toRemove = allMarks.map(function (m) { return mark_1.hasMark(state, { mark: m }) && marks[m]; }).filter(function (m) { return m; }); | ||
var allMarks = tslib_1.__spreadArray([mark], altMarks, true).filter(function (m) { return marks[m]; }); | ||
var toRemove = allMarks.map(function (m) { return (0, mark_1.hasMark)(state, { mark: m }) && marks[m]; }).filter(function (m) { return m; }); | ||
if (toRemove.length) { | ||
mark_1.removeMarks(toRemove, state, markDispatched, transaction); | ||
(0, mark_1.removeMarks)(toRemove, state, markDispatched, transaction); | ||
} | ||
else { | ||
if (!styleRemoved) { | ||
mark_1.toggleMark(marks[mark], markAttrs, transaction)(state, markDispatched); | ||
(0, mark_1.toggleMark)(marks[mark], markAttrs, transaction)(state, markDispatched); | ||
} | ||
@@ -159,3 +159,3 @@ } | ||
var _a = state.selection, empty = _a.empty, $cursor = _a.$cursor, ranges = _a.ranges; | ||
if ((empty && !$cursor) || !markType || !mark_1.markApplies(state.doc, ranges, markType)) { | ||
if ((empty && !$cursor) || !markType || !(0, mark_1.markApplies)(state.doc, ranges, markType)) { | ||
return false; | ||
@@ -169,3 +169,3 @@ } | ||
if (currentMark && currentMark.attrs.style) { | ||
var resultStyles = utils_1.changeStylesString(currentMark.attrs.style, attrs); | ||
var resultStyles = (0, utils_1.changeStylesString)(currentMark.attrs.style, attrs); | ||
if (resultStyles.changed && resultStyles.style) { | ||
@@ -176,3 +176,3 @@ newStyles.style = resultStyles.style; | ||
else if (attrs.newValue) { | ||
newStyles.style = [attrs.style] + ": " + attrs.newValue + ";"; | ||
newStyles.style = "".concat([attrs.style], ": ").concat(attrs.newValue, ";"); | ||
} | ||
@@ -179,0 +179,0 @@ var newMarkAttrs_2 = currentMark ? tslib_1.__assign(tslib_1.__assign({}, currentMark.attrs), newStyles) : newStyles; |
@@ -45,3 +45,3 @@ "use strict"; | ||
if (!$cursor) { | ||
inline_style_1.toggleInlineFormat(options, tr)(state, dispatch); | ||
(0, inline_style_1.toggleInlineFormat)(options, tr)(state, dispatch); | ||
} | ||
@@ -67,3 +67,3 @@ else { | ||
} | ||
dispatch(mark_1.removeMark(tr || state.tr, linkStart, linkStart + linkSize, mark)); | ||
dispatch((0, mark_1.removeMark)(tr || state.tr, linkStart, linkStart + linkSize, mark)); | ||
} | ||
@@ -76,3 +76,3 @@ }; }; | ||
var getParentMark = function (state, markType) { | ||
var marks = mark_1.selectionMarks(state, markType); | ||
var marks = (0, mark_1.selectionMarks)(state, markType); | ||
return marks.length === 1 && marks[0] ? marks[0] : null; | ||
@@ -97,11 +97,11 @@ }; | ||
var nextState = state; | ||
if (mark_1.hasMark(state, { mark: mark })) { | ||
exports.removeLink({ mark: mark, attrs: attrs }, tr)(state, markDispatched); | ||
if ((0, mark_1.hasMark)(state, { mark: mark })) { | ||
(0, exports.removeLink)({ mark: mark, attrs: attrs }, tr)(state, markDispatched); | ||
nextState = prosemirror_state_1.EditorState.create({ doc: tr.doc, selection: tr.selection }); | ||
} | ||
if (dispatched) { | ||
mark_1.toggleMark(marks[mark], attrs, tr)(nextState, markDispatched); | ||
(0, mark_1.toggleMark)(marks[mark], attrs, tr)(nextState, markDispatched); | ||
} | ||
else { | ||
inline_style_1.toggleInlineFormat({ mark: mark }, tr, attrs)(nextState, markDispatched); | ||
(0, inline_style_1.toggleInlineFormat)({ mark: mark }, tr, attrs)(nextState, markDispatched); | ||
} | ||
@@ -108,0 +108,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
html = html.replace(msoListRegExp, function (match, list, level) { | ||
return "datalist=\"" + list + "\" datalevel=\"" + level + "\" " + match; | ||
return "datalist=\"".concat(list, "\" datalevel=\"").concat(level, "\" ").concat(match); | ||
}); | ||
@@ -121,3 +121,3 @@ return html; | ||
var li = document.createElement('li'); | ||
li.appendChild(source_1.htmlToFragment(content)); | ||
li.appendChild((0, source_1.htmlToFragment)(content)); | ||
return li; | ||
@@ -185,8 +185,8 @@ }; | ||
var convertMsLists = function (html) { | ||
var container = source_1.htmlToFragment(extractListLevels(html)); | ||
var container = (0, source_1.htmlToFragment)(extractListLevels(html)); | ||
var groups = new Set(); | ||
mapListsCandidates(container.children, groups); | ||
groups.forEach(function (listsCandidates) { return toList(listsCandidates); }); | ||
return source_1.fragmentToHtml(container); | ||
return (0, source_1.fragmentToHtml)(container); | ||
}; | ||
exports.convertMsLists = convertMsLists; |
@@ -5,3 +5,3 @@ import { NodeType, Node } from 'prosemirror-model'; | ||
import { Command } from './types/command'; | ||
declare type ListOptions = { | ||
type ListOptions = { | ||
listType: string; | ||
@@ -15,2 +15,3 @@ orderedList: string; | ||
* Extracts list-style-type style from node's attributes. | ||
* | ||
* @param attrs - The attributes of the list node | ||
@@ -17,0 +18,0 @@ * @returns The extracted list-style-type. |
@@ -112,3 +112,3 @@ "use strict"; | ||
} | ||
return tr.lift(range, prosemirror_transform_1.liftTarget(range)).scrollIntoView(); | ||
return tr.lift(range, (0, prosemirror_transform_1.liftTarget)(range)).scrollIntoView(); | ||
} | ||
@@ -143,3 +143,3 @@ function liftFollowingList(state, from, to, rootListDepthNum, tr, listItem) { | ||
// Returns all top-level ancestor-nodes between $from and $to | ||
var nodes = Array(); | ||
var nodes = []; | ||
var maxDepth = findAncestorPosition(doc, $from).depth; | ||
@@ -202,3 +202,3 @@ var current = doc.resolve($from.start(maxDepth)); | ||
} | ||
var target = range && prosemirror_transform_1.liftTarget(range); | ||
var target = range && (0, prosemirror_transform_1.liftTarget)(range); | ||
if (target === undefined || target === null) { | ||
@@ -218,3 +218,3 @@ return false; | ||
if (attrs === void 0) { attrs = {}; } | ||
return prosemirror_commands_1.autoJoin(prosemirror_schema_list_1.wrapInList(nodeType, attrs), function (before, after) { return before.type === after.type && before.type === nodeType; }); | ||
return (0, prosemirror_commands_1.autoJoin)((0, prosemirror_schema_list_1.wrapInList)(nodeType, attrs), function (before, after) { return before.type === after.type && before.type === nodeType; }); | ||
} | ||
@@ -224,2 +224,3 @@ var reListStyle = /list\-style\-type:\s?([\w-]+)/; | ||
* Extracts list-style-type style from node's attributes. | ||
* | ||
* @param attrs - The attributes of the list node | ||
@@ -239,4 +240,4 @@ * @returns The extracted list-style-type. | ||
var endNode = selection.$to.node(selection.$to.depth - 2); | ||
if (!fromNode || fromNode.type.name !== listType || exports.listStyle(fromNode.attrs) !== exports.listStyle(listAttrs) || | ||
(!endNode || endNode.type.name !== listType || exports.listStyle(endNode.attrs) !== exports.listStyle(listAttrs))) { | ||
if (!fromNode || fromNode.type.name !== listType || (0, exports.listStyle)(fromNode.attrs) !== (0, exports.listStyle)(listAttrs) || | ||
(!endNode || endNode.type.name !== listType || (0, exports.listStyle)(endNode.attrs) !== (0, exports.listStyle)(listAttrs))) { | ||
return toggleListCommand(options)(state, dispatch, view); | ||
@@ -261,7 +262,7 @@ } | ||
function toggleUnorderedList(state, dispatch, view) { | ||
return exports.toggleList(state, dispatch, view, tslib_1.__assign({ listType: list_settings_1.bulletList.listType }, list_settings_1.bulletList.types)); | ||
return (0, exports.toggleList)(state, dispatch, view, tslib_1.__assign({ listType: list_settings_1.bulletList.listType }, list_settings_1.bulletList.types)); | ||
} | ||
exports.toggleUnorderedList = toggleUnorderedList; | ||
function toggleOrderedList(state, dispatch, view) { | ||
return exports.toggleList(state, dispatch, view, tslib_1.__assign({ listType: list_settings_1.orderedList.listType }, list_settings_1.orderedList.types)); | ||
return (0, exports.toggleList)(state, dispatch, view, tslib_1.__assign({ listType: list_settings_1.orderedList.listType }, list_settings_1.orderedList.types)); | ||
} | ||
@@ -271,3 +272,3 @@ exports.toggleOrderedList = toggleOrderedList; | ||
// see https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L321-L327 | ||
return prosemirror_schema_list_1.splitListItem(itemType)(state, function (tr) { | ||
return (0, prosemirror_schema_list_1.splitListItem)(itemType)(state, function (tr) { | ||
var marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks()); | ||
@@ -274,0 +275,0 @@ if (marks) { |
@@ -33,3 +33,3 @@ "use strict"; | ||
var _a = state.selection, empty = _a.empty, $cursor = _a.$cursor, ranges = _a.ranges; | ||
if ((empty && !$cursor) || !exports.markApplies(state.doc, ranges, markType)) { | ||
if ((empty && !$cursor) || !(0, exports.markApplies)(state.doc, ranges, markType)) { | ||
return false; | ||
@@ -130,3 +130,3 @@ } | ||
marks.forEach(function (m) { | ||
exports.removeMark(tr, $from.pos, $to.pos, m); | ||
(0, exports.removeMark)(tr, $from.pos, $to.pos, m); | ||
}); | ||
@@ -147,3 +147,3 @@ }; | ||
var tr = state.tr; | ||
exports.cleanMarks(tr, { except: toArray(except) }); | ||
(0, exports.cleanMarks)(tr, { except: toArray(except) }); | ||
if (tr.docChanged) { | ||
@@ -200,4 +200,4 @@ dispatch(tr); | ||
if (!result && altStyle && marks.style) { | ||
return exports.selectionMarks(state, marks.style) | ||
.some(function (mark) { return exports.styleValue(mark, altStyle) !== null; }); | ||
return (0, exports.selectionMarks)(state, marks.style) | ||
.some(function (mark) { return (0, exports.styleValue)(mark, altStyle) !== null; }); | ||
} | ||
@@ -243,3 +243,3 @@ return Boolean(result); | ||
var getMark = function (state, markType) { | ||
var marks = exports.selectionMarks(state, markType); | ||
var marks = (0, exports.selectionMarks)(state, markType); | ||
var filtered = marks.filter(function (m) { return Boolean(m); }); | ||
@@ -253,3 +253,3 @@ return marks.length === filtered.length ? marks[0] : undefined; | ||
var getActiveMarks = function (state, markType) { | ||
var marks = exports.selectionMarks(state, markType); | ||
var marks = (0, exports.selectionMarks)(state, markType); | ||
var filtered = marks.filter(function (m) { return Boolean(m); }); | ||
@@ -256,0 +256,0 @@ var hasNodesWithoutMarks = marks.length !== filtered.length; |
@@ -51,3 +51,3 @@ "use strict"; | ||
if (/^Mso/.test(attr.value)) { | ||
exports.removeAttribute(attr); | ||
(0, exports.removeAttribute)(attr); | ||
} | ||
@@ -70,3 +70,3 @@ }; | ||
if (supportedStyles[name] !== undefined) { | ||
result += name + ": " + value + "; "; | ||
result += "".concat(name, ": ").concat(value, "; "); | ||
} | ||
@@ -79,3 +79,3 @@ }); | ||
else { | ||
exports.removeAttribute(attr); | ||
(0, exports.removeAttribute)(attr); | ||
} | ||
@@ -116,11 +116,11 @@ }; | ||
if (settings.convertMsLists) { | ||
result = listConvert_1.convertMsLists(result); | ||
result = (0, listConvert_1.convertMsLists)(result); | ||
} | ||
if (settings.stripTags) { | ||
result = exports.removeTag(result, settings.stripTags); | ||
result = (0, exports.removeTag)(result, settings.stripTags); | ||
} | ||
if (settings.attributes) { | ||
var fragment = source_1.htmlToFragment(result); | ||
var fragment = (0, source_1.htmlToFragment)(result); | ||
Array.from(fragment.querySelectorAll('*')).forEach(function (node) { return sanitizeNode(node, settings.attributes); }); | ||
result = source_1.fragmentToHtml(fragment); | ||
result = (0, source_1.fragmentToHtml)(fragment); | ||
} | ||
@@ -169,3 +169,3 @@ return result; | ||
var hex = image.replace(reRtfImgHeader, '').replace(reNonHex, ''); | ||
base64Sources.push("data:image/" + extension[1] + ";base64," + convertHexToBase64(hex)); | ||
base64Sources.push("data:image/".concat(extension[1], ";base64,").concat(convertHexToBase64(hex))); | ||
} | ||
@@ -172,0 +172,0 @@ } |
@@ -17,3 +17,3 @@ "use strict"; | ||
} | ||
var color = mark_1.styleValue((storedMarks || []).find(function (m) { return m.type.name === 'style'; }), { name: 'color', value: /^.+$/ }); | ||
var color = (0, mark_1.styleValue)((storedMarks || []).find(function (m) { return m.type.name === 'style'; }), { name: 'color', value: /^.+$/ }); | ||
if (!color) { | ||
@@ -20,0 +20,0 @@ return prosemirror_view_1.DecorationSet.empty; |
@@ -1,2 +0,2 @@ | ||
import { Plugin } from "prosemirror-state"; | ||
import { Plugin } from 'prosemirror-state'; | ||
export declare const cspFix: () => Plugin<any>; |
@@ -9,3 +9,3 @@ "use strict"; | ||
if (attrName) { | ||
utils_1.setAttribute(dom, attrName, attrs[attrName]); | ||
(0, utils_1.setAttribute)(dom, attrName, attrs[attrName]); | ||
} | ||
@@ -26,3 +26,3 @@ } | ||
var StyleView = /** @class */ (function () { | ||
function StyleView(mark, view, _inline) { | ||
function StyleView(mark, view) { | ||
this.mark = mark; | ||
@@ -52,3 +52,3 @@ this.view = view; | ||
markViews: { | ||
style: function (mark, view, inline) { return new StyleView(mark, view, inline); } | ||
style: function (mark, view) { return new StyleView(mark, view); } | ||
} | ||
@@ -55,0 +55,0 @@ } |
import { Plugin, PluginKey } from 'prosemirror-state'; | ||
import { DecorationAttrs } from "prosemirror-view"; | ||
import { DecorationAttrs } from 'prosemirror-view'; | ||
export interface InlineDecoration { | ||
@@ -4,0 +4,0 @@ from: number; |
@@ -1,2 +0,2 @@ | ||
import { Plugin, PluginKey, Transaction } from "prosemirror-state"; | ||
import { Plugin, PluginKey, Transaction } from 'prosemirror-state'; | ||
export declare const imageResizeKey: PluginKey<any>; | ||
@@ -3,0 +3,0 @@ interface Rect { |
@@ -24,7 +24,7 @@ "use strict"; | ||
ResizeState.prototype.apply = function (tr) { | ||
var state = this, next = tr.getMeta(exports.imageResizeKey); | ||
var next = tr.getMeta(exports.imageResizeKey); | ||
if (next) { | ||
return new ResizeState(next.activeHandle, next.setDragging, next.rect, next.nodePosition); | ||
} | ||
return state; | ||
return this; | ||
}; | ||
@@ -80,4 +80,4 @@ return ResizeState; | ||
if (reSize.test(currAttrs.style || '')) { | ||
var changedWidth = utils_1.changeStylesString(currAttrs.style, { style: 'width', value: reAnyValue, newValue: width + 'px' }); | ||
var style = utils_1.changeStylesString(changedWidth.style || '', { style: 'height', value: reAnyValue, newValue: height + 'px' }).style; | ||
var changedWidth = (0, utils_1.changeStylesString)(currAttrs.style, { style: 'width', value: reAnyValue, newValue: width + 'px' }); | ||
var style = (0, utils_1.changeStylesString)(changedWidth.style || '', { style: 'height', value: reAnyValue, newValue: height + 'px' }).style; | ||
attrs = tslib_1.__assign(tslib_1.__assign({}, currAttrs), { style: style }); | ||
@@ -84,0 +84,0 @@ } |
@@ -34,3 +34,3 @@ "use strict"; | ||
if ((node.type.name === options.listItem) && inSelection(from, to, pos, node, doc)) { | ||
transaction.setNodeMarkup(pos, null, tslib_1.__assign(tslib_1.__assign({}, node.attrs), { style: utils_1.applyStyle(node.attrs.style, args.style, args.value) })); | ||
transaction.setNodeMarkup(pos, null, tslib_1.__assign(tslib_1.__assign({}, node.attrs), { style: (0, utils_1.applyStyle)(node.attrs.style, args.style, args.value) })); | ||
} | ||
@@ -43,9 +43,9 @@ }); | ||
var transaction = state.tr, doc = state.doc, _a = state.selection, from = _a.from, to = _a.to; | ||
doc.nodesBetween(from, to, function (node, pos, _parent) { | ||
doc.nodesBetween(from, to, function (node, pos) { | ||
if (node.type.name === options.listItem && inSelection(from, to, pos, node, doc)) { | ||
var attrs_1 = node.attrs; | ||
var nodeStyles_1 = utils_1.parseStyle(node.attrs.style); | ||
var nodeStyles_1 = (0, utils_1.parseStyle)(node.attrs.style); | ||
stylesToClean.forEach(function (style) { | ||
if (nodeStyles_1[style]) { | ||
attrs_1 = tslib_1.__assign(tslib_1.__assign({}, attrs_1), { style: utils_1.applyStyle(attrs_1.style, style, '') }); | ||
attrs_1 = tslib_1.__assign(tslib_1.__assign({}, attrs_1), { style: (0, utils_1.applyStyle)(attrs_1.style, style, '') }); | ||
} | ||
@@ -62,9 +62,9 @@ }); | ||
if (mark.type.name === 'style' && mark.attrs.style) { | ||
var _a = mark.attrs.style.split(/\s*:\s*/), name_1 = _a[0], _value = _a[1]; | ||
var name_1 = mark.attrs.style.split(/\s*:\s*/)[0]; | ||
var $pos = transaction.doc.resolve(step.from); | ||
var li = utils_1.parentNode($pos, function (n) { return n.type.name === options.listItem; }); | ||
var li = (0, utils_1.parentNode)($pos, function (n) { return n.type.name === options.listItem; }); | ||
if (li) { | ||
var liStyles = utils_1.parseStyle(li.node.attrs.style); | ||
var liStyles = (0, utils_1.parseStyle)(li.node.attrs.style); | ||
if (liStyles[name_1] && options.resetValues[name_1]) { | ||
var newMark = mark.type.create({ style: name_1 + ": " + options.resetValues[name_1] + ";" }); | ||
var newMark = mark.type.create({ style: "".concat(name_1, ": ").concat(options.resetValues[name_1], ";") }); | ||
transaction.addMark(step.from, step.to, newMark); | ||
@@ -71,0 +71,0 @@ } |
@@ -17,3 +17,3 @@ "use strict"; | ||
state: { | ||
init: function (_, _state) { | ||
init: function () { | ||
return new ResizeState(-1, null); | ||
@@ -27,3 +27,3 @@ }, | ||
attributes: function (state) { | ||
if (utils_2.otherResizeHandle(utils_2.tableColumnResizeKey, state)) { | ||
if ((0, utils_2.otherResizeHandle)(utils_2.tableColumnResizeKey, state)) { | ||
return null; | ||
@@ -36,3 +36,3 @@ } | ||
mousemove: function (view, event) { | ||
if (!utils_2.otherResizing(utils_2.tableColumnResizeKey, view.state)) { | ||
if (!(0, utils_2.otherResizing)(utils_2.tableColumnResizeKey, view.state)) { | ||
handleMouseMove(view, event, handleWidth); | ||
@@ -51,3 +51,3 @@ } | ||
decorations: function (state) { | ||
if (!utils_2.otherResizing(utils_2.tableColumnResizeKey, state)) { | ||
if (!(0, utils_2.otherResizing)(utils_2.tableColumnResizeKey, state)) { | ||
var pluginState = utils_2.tableColumnResizeKey.getState(state); | ||
@@ -78,3 +78,4 @@ if (pluginState.activeHandle > -1) { | ||
ResizeState.prototype.apply = function (tr) { | ||
var state = this, action = tr.getMeta(utils_2.tableColumnResizeKey); | ||
var state; | ||
var action = tr.getMeta(utils_2.tableColumnResizeKey); | ||
if (action && action.setHandle != null) { | ||
@@ -84,12 +85,12 @@ return new ResizeState(action.setHandle, null); | ||
if (action && action.setDragging !== undefined) { | ||
return new ResizeState(state.activeHandle, action.setDragging); | ||
return new ResizeState(this.activeHandle, action.setDragging); | ||
} | ||
if (state.activeHandle > -1 && tr.docChanged) { | ||
var handle = tr.mapping.map(state.activeHandle, -1); | ||
if (this.activeHandle > -1 && tr.docChanged) { | ||
var handle = tr.mapping.map(this.activeHandle, -1); | ||
if (!pointsAtCell(tr.doc.resolve(handle))) { | ||
handle = -1; | ||
} | ||
state = new ResizeState(handle, state.dragging); | ||
state = new ResizeState(handle, this.dragging); | ||
} | ||
return state; | ||
return state || this; | ||
}; | ||
@@ -101,12 +102,13 @@ return ResizeState; | ||
if (!pluginState.dragging) { | ||
var target = utils_2.domCellAround(event.target), cell = -1; | ||
var target = (0, utils_2.domCellAround)(event.target); | ||
var cell = -1; | ||
if (target) { | ||
var indexes = utils_2.cellIndexes(target); | ||
var indexes = (0, utils_2.cellIndexes)(target); | ||
var _a = target.getBoundingClientRect(), left = _a.left, right = _a.right; | ||
if (Math.abs(event.clientX - left) <= handleWidth && indexes.cellIndex > 0) { | ||
indexes.cellIndex -= target.colSpan; | ||
cell = utils_2.edgeCell(view, event, indexes); | ||
cell = (0, utils_2.edgeCell)(view, event, indexes); | ||
} | ||
else if (right - event.clientX > 0 && right - event.clientX <= handleWidth) { | ||
cell = utils_2.edgeCell(view, event, indexes); | ||
cell = (0, utils_2.edgeCell)(view, event, indexes); | ||
} | ||
@@ -172,3 +174,3 @@ } | ||
var sum = widths.reduce(function (acc, cur) { return acc + parseFloat(cur); }, 0); | ||
tableAttrs = utils_1.setNodeStyle(tableAttrs || tableNode.attrs, 'width', sum + 'px'); | ||
tableAttrs = (0, utils_1.setNodeStyle)(tableAttrs || tableNode.attrs, 'width', sum + 'px'); | ||
} | ||
@@ -187,3 +189,3 @@ } | ||
var transaction = view.state.tr; | ||
updateColumnWidth(view, transaction, curPluginState.activeHandle, draggedWidth(curPluginState.dragging, ev, cellMinWidth)); | ||
updateColumnWidth(view, transaction, curPluginState.activeHandle); | ||
view.dispatch(transaction.setMeta(utils_2.tableColumnResizeKey, { setDragging: null })); | ||
@@ -198,3 +200,3 @@ } | ||
var dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth); | ||
displayColumnWidth(view, curPluginState.activeHandle, dragged, cellMinWidth); | ||
displayColumnWidth(view, curPluginState.activeHandle, dragged); | ||
} | ||
@@ -216,3 +218,3 @@ event.view.addEventListener('mouseup', finish); | ||
} | ||
function updateColumnWidth(view, tr, cell, _width) { | ||
function updateColumnWidth(view, tr, cell) { | ||
var _a; | ||
@@ -229,8 +231,8 @@ var $cell = view.state.doc.resolve(cell); | ||
var tableDomWidth = tableDom.style.width; | ||
if (tableDom && tableDomWidth && utils_1.parseStyle(attrs.style).width !== tableDomWidth) { | ||
attrs = utils_1.setNodeStyle(attrs, 'width', tableDomWidth); | ||
if (tableDom && tableDomWidth && (0, utils_1.parseStyle)(attrs.style).width !== tableDomWidth) { | ||
attrs = (0, utils_1.setNodeStyle)(attrs, 'width', tableDomWidth); | ||
} | ||
tr.setNodeMarkup(tablePos, null, attrs); | ||
} | ||
function displayColumnWidth(view, cell, width, _cellMinWidth) { | ||
function displayColumnWidth(view, cell, width) { | ||
var $cell = view.state.doc.resolve(cell); | ||
@@ -237,0 +239,0 @@ var table = $cell.node(-1), start = $cell.start(-1); |
@@ -8,5 +8,5 @@ "use strict"; | ||
var tableResizing = function () { return [ | ||
table_resize_1.tableResizing(), | ||
column_resize_1.columnResizing(), | ||
row_resize_1.rowResizing() | ||
(0, table_resize_1.tableResizing)(), | ||
(0, column_resize_1.columnResizing)(), | ||
(0, row_resize_1.rowResizing)() | ||
]; }; | ||
@@ -13,0 +13,0 @@ exports.tableResizing = tableResizing; |
@@ -23,3 +23,3 @@ "use strict"; | ||
init: function (_, state) { | ||
this.spec.props.nodeViews[prosemirror_tables_1.tableNodeTypes(state.schema).row.name] = function (_node, _view) { return new TableRowView(); }; | ||
this.spec.props.nodeViews[(0, prosemirror_tables_1.tableNodeTypes)(state.schema).row.name] = function () { return new TableRowView(); }; | ||
return new ResizeState(-1, null); | ||
@@ -33,3 +33,3 @@ }, | ||
attributes: function (state) { | ||
if (utils_1.otherResizeHandle(utils_1.tableRowResizeKey, state)) { | ||
if ((0, utils_1.otherResizeHandle)(utils_1.tableRowResizeKey, state)) { | ||
return null; | ||
@@ -42,3 +42,3 @@ } | ||
mousemove: function (view, event) { | ||
if (!utils_1.otherResizing(utils_1.tableRowResizeKey, view.state)) { | ||
if (!(0, utils_1.otherResizing)(utils_1.tableRowResizeKey, view.state)) { | ||
handleMouseMove(view, event, handleWidth); | ||
@@ -57,3 +57,3 @@ } | ||
decorations: function (state) { | ||
if (utils_1.otherResizing(utils_1.tableRowResizeKey, state)) { | ||
if ((0, utils_1.otherResizing)(utils_1.tableRowResizeKey, state)) { | ||
return prosemirror_view_1.DecorationSet.empty; | ||
@@ -81,3 +81,3 @@ } | ||
ResizeState.prototype.apply = function (tr) { | ||
var state = this, action = tr.getMeta(utils_1.tableRowResizeKey); | ||
var state, action = tr.getMeta(utils_1.tableRowResizeKey); | ||
if (action && action.setHandle != null) { | ||
@@ -87,12 +87,12 @@ return new ResizeState(action.setHandle, null); | ||
if (action && action.setDragging !== undefined) { | ||
return new ResizeState(state.activeHandle, action.setDragging); | ||
return new ResizeState(this.activeHandle, action.setDragging); | ||
} | ||
if (state.activeHandle > -1) { | ||
var handle = tr.mapping.map(state.activeHandle, -1); | ||
if (this.activeHandle > -1) { | ||
var handle = tr.mapping.map(this.activeHandle, -1); | ||
if (!pointsAtCell(tr.doc.resolve(handle))) { | ||
handle = null; | ||
} | ||
state = new ResizeState(handle, state.dragging); | ||
state = new ResizeState(handle, this.dragging); | ||
} | ||
return state; | ||
return state || this; | ||
}; | ||
@@ -104,12 +104,12 @@ return ResizeState; | ||
if (!pluginState.dragging) { | ||
var target = utils_1.domCellAround(event.target), cell = -1; | ||
var target = (0, utils_1.domCellAround)(event.target), cell = -1; | ||
if (target) { | ||
var indexes = utils_1.cellIndexes(target); | ||
var indexes = (0, utils_1.cellIndexes)(target); | ||
var _a = target.getBoundingClientRect(), top_1 = _a.top, bottom = _a.bottom; | ||
if (Math.abs(event.clientY - top_1) <= handleWidth && indexes.rowIndex > 0) { | ||
indexes.rowIndex -= target.rowSpan; | ||
cell = utils_1.edgeCell(view, event, indexes); | ||
cell = (0, utils_1.edgeCell)(view, event, indexes); | ||
} | ||
else if (bottom - event.clientY > 0 && bottom - event.clientY <= handleWidth) { | ||
cell = utils_1.edgeCell(view, event, indexes); | ||
cell = (0, utils_1.edgeCell)(view, event, indexes); | ||
} | ||
@@ -137,4 +137,4 @@ } | ||
var table = $cell.node(-1); | ||
var rowHeightStr = utils_2.parseStyle(row.attrs.style).height; | ||
var tableHeight = utils_2.parseStyle(table.attrs.style).height; | ||
var rowHeightStr = (0, utils_2.parseStyle)(row.attrs.style).height; | ||
var tableHeight = (0, utils_2.parseStyle)(table.attrs.style).height; | ||
var rowHeight = rowHeightStr ? parseFloat(rowHeightStr) : 0; | ||
@@ -193,3 +193,3 @@ if (!rowHeightStr) { | ||
dom.style.height = win.getComputedStyle(dom).height; | ||
tr.setNodeMarkup(rowPos, null, utils_2.setNodeStyle(row.attrs, 'height', dom.style.height)); | ||
tr.setNodeMarkup(rowPos, null, (0, utils_2.setNodeStyle)(row.attrs, 'height', dom.style.height)); | ||
var table = dom && dom.closest('table'); | ||
@@ -200,3 +200,3 @@ var tableHeight = table && table.style.height; | ||
var tablePos = $pos.start($pos.depth) - 1; | ||
tr.setNodeMarkup(tablePos, null, utils_2.setNodeStyle($pos.parent.attrs, 'height', tableHeight)); | ||
tr.setNodeMarkup(tablePos, null, (0, utils_2.setNodeStyle)($pos.parent.attrs, 'height', tableHeight)); | ||
} | ||
@@ -203,0 +203,0 @@ } |
@@ -25,3 +25,3 @@ "use strict"; | ||
ResizeState.prototype.apply = function (tr) { | ||
var state = this, next = tr.getMeta(utils_1.tableResizeKey); | ||
var next = tr.getMeta(utils_1.tableResizeKey); | ||
if (next) { | ||
@@ -31,3 +31,3 @@ var nextState = new ResizeState(next.activeHandle, next.setDragging, next.nodePosition); | ||
} | ||
return state; | ||
return this; | ||
}; | ||
@@ -43,3 +43,3 @@ return ResizeState; | ||
} | ||
var tableDom = utils_1.getTable(view.nodeDOM(nodePosition)); | ||
var tableDom = (0, utils_1.getTable)(view.nodeDOM(nodePosition)); | ||
var rect = tableDom.getBoundingClientRect(); | ||
@@ -72,3 +72,3 @@ var dir = resize_utils_1.directions[activeHandle]; | ||
var tableNode = view.state.doc.nodeAt(tablePos); | ||
var tableDom = utils_1.getTable(view.nodeDOM(tablePos)); | ||
var tableDom = (0, utils_1.getTable)(view.nodeDOM(tablePos)); | ||
var _a = tableSize(tableDom), width = _a.width, height = _a.height, colsWidth = _a.colsWidth, rowsHeight = _a.rowsHeight, offsetWidth = _a.offsetWidth, offsetHeight = _a.offsetHeight; | ||
@@ -86,5 +86,5 @@ var colgroup = tableDom.firstChild; | ||
tableNode.forEach(function (row, offset, index) { | ||
var rowHeight = utils_2.parseStyle(row.attrs.style).height; | ||
var rowHeight = (0, utils_2.parseStyle)(row.attrs.style).height; | ||
if (rowHeight && !/%$/.test(rowHeight)) { | ||
tr.setNodeMarkup(tablePos + offset + 1, null, utils_2.setNodeStyle(row.attrs, 'height', (rowsHeight[index] * 100 / height) + '%')); | ||
tr.setNodeMarkup(tablePos + offset + 1, null, (0, utils_2.setNodeStyle)(row.attrs, 'height', (rowsHeight[index] * 100 / height) + '%')); | ||
heightChange = true; | ||
@@ -94,4 +94,4 @@ } | ||
var tableAttrs = tableNode.attrs; | ||
if (utils_2.parseStyle(tableAttrs.style).width !== offsetWidth + 'px') { | ||
tableAttrs = utils_2.setNodeStyle(tableAttrs, 'width', offsetWidth + 'px'); | ||
if ((0, utils_2.parseStyle)(tableAttrs.style).width !== offsetWidth + 'px') { | ||
tableAttrs = (0, utils_2.setNodeStyle)(tableAttrs, 'width', offsetWidth + 'px'); | ||
} | ||
@@ -102,3 +102,3 @@ if (widthChanged) { | ||
if (heightChange) { | ||
tableAttrs = utils_2.setNodeStyle(tableAttrs, 'height', offsetHeight + 'px'); | ||
tableAttrs = (0, utils_2.setNodeStyle)(tableAttrs, 'height', offsetHeight + 'px'); | ||
} | ||
@@ -111,3 +111,3 @@ if (widthChanged || heightChange) { | ||
var tableNode = view.state.doc.nodeAt(tablePos); | ||
var tableDom = utils_1.getTable(view.nodeDOM(tablePos)); | ||
var tableDom = (0, utils_1.getTable)(view.nodeDOM(tablePos)); | ||
var win = (tableDom.ownerDocument && tableDom.ownerDocument.defaultView) || window; | ||
@@ -117,5 +117,5 @@ var calcStyle = win.getComputedStyle; | ||
tableNode.forEach(function (row, offset, index) { | ||
var rowHeight = utils_2.parseStyle(row.attrs.style).height; | ||
var rowHeight = (0, utils_2.parseStyle)(row.attrs.style).height; | ||
if (rowHeight && !/px$/.test(rowHeight)) { | ||
tr.setNodeMarkup(tablePos + offset + 1, null, utils_2.setNodeStyle(row.attrs, 'height', calcStyle(rows[index]).height)); | ||
tr.setNodeMarkup(tablePos + offset + 1, null, (0, utils_2.setNodeStyle)(row.attrs, 'height', calcStyle(rows[index]).height)); | ||
} | ||
@@ -152,3 +152,3 @@ }); | ||
var node = view.state.doc.nodeAt(nodePosition); | ||
var dom = utils_1.getTable(view.nodeDOM(nodePosition)); | ||
var dom = (0, utils_1.getTable)(view.nodeDOM(nodePosition)); | ||
var rect = tableSize(dom); | ||
@@ -160,8 +160,8 @@ if (node) { | ||
var attrs = node.attrs; | ||
var parsedStyles = utils_2.parseStyle(attrs.style); | ||
var parsedStyles = (0, utils_2.parseStyle)(attrs.style); | ||
if (horizontalDir[activeHandle] && dom.style.width && parsedStyles.width !== width) { | ||
attrs = utils_2.setNodeStyle(attrs, 'width', width); | ||
attrs = (0, utils_2.setNodeStyle)(attrs, 'width', width); | ||
} | ||
if (verticalDir[activeHandle] && dom.style.height && parsedStyles.height !== height) { | ||
attrs = utils_2.setNodeStyle(attrs, 'height', height); | ||
attrs = (0, utils_2.setNodeStyle)(attrs, 'height', height); | ||
} | ||
@@ -177,7 +177,7 @@ attrs = toPixels(view, tr, nodePosition, attrs); | ||
}); | ||
if (!/%/.test(utils_2.parseStyle(attrs.style).width || '')) { | ||
if (!/%/.test((0, utils_2.parseStyle)(attrs.style).width || '')) { | ||
var $pos = tr.doc.resolve(nodePosition); | ||
var wrapper = utils_2.parentNode($pos, function (n) { return n.type.name === 'table_wrapper'; }); | ||
if (wrapper && /%/.test(utils_2.parseStyle(wrapper.node.attrs.style).width || '')) { | ||
var wrapperAttrs = utils_2.setNodeStyle(wrapper.node.attrs, 'width', ''); | ||
var wrapper = (0, utils_2.parentNode)($pos, function (n) { return n.type.name === 'table_wrapper'; }); | ||
if (wrapper && /%/.test((0, utils_2.parseStyle)(wrapper.node.attrs.style).width || '')) { | ||
var wrapperAttrs = (0, utils_2.setNodeStyle)(wrapper.node.attrs, 'width', ''); | ||
var wrapperPos = $pos.start(wrapper.depth) - 1; | ||
@@ -212,3 +212,3 @@ tr.setNodeMarkup(wrapperPos, null, wrapperAttrs); | ||
} | ||
function finish(_e) { | ||
function finish() { | ||
curWindow.removeEventListener('mouseup', finish); | ||
@@ -226,3 +226,3 @@ curWindow.removeEventListener('mousemove', move); | ||
key: utils_1.tableResizeKey, | ||
view: function (_viewObj) { return ({ | ||
view: function () { return ({ | ||
selectedNode: function (state, nodeType) { | ||
@@ -234,3 +234,3 @@ var selection = state.selection; | ||
} | ||
var parent = utils_2.parentNode(selection.$from, function (n) { return n.type === nodeType; }); | ||
var parent = (0, utils_2.parentNode)(selection.$from, function (n) { return n.type === nodeType; }); | ||
var node = parent && parent.node; | ||
@@ -244,3 +244,3 @@ if (node) { | ||
update: function (view, prevState) { | ||
var _a, _b, _c, _d, _f; | ||
var _a, _b, _c, _d, _e; | ||
var state = view.state; | ||
@@ -277,3 +277,3 @@ var nodeType = state.schema.nodes[options.node]; | ||
tr.setMeta(utils_1.tableResizeKey, { nodePosition: -1 }); | ||
view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, tslib_1.__assign(tslib_1.__assign({}, prevSelected.node.attrs), (_f = {}, _f[constants_1.resizableAttr] = false, _f)))); | ||
view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, tslib_1.__assign(tslib_1.__assign({}, prevSelected.node.attrs), (_e = {}, _e[constants_1.resizableAttr] = false, _e)))); | ||
} | ||
@@ -280,0 +280,0 @@ } |
@@ -70,3 +70,3 @@ "use strict"; | ||
if (colgroupStr) { | ||
this.colgroup = schema_1.parseStrColgroup(colgroupStr); | ||
this.colgroup = (0, schema_1.parseStrColgroup)(colgroupStr); | ||
this.table.insertBefore(this.colgroup, this.table.firstChild); | ||
@@ -79,3 +79,3 @@ } | ||
if (attrName && skip.indexOf(attrName) === -1) { | ||
utils_1.setAttribute(table, attrName, attrs[attrName]); | ||
(0, utils_1.setAttribute)(table, attrName, attrs[attrName]); | ||
} | ||
@@ -120,3 +120,3 @@ } | ||
if (attrName) { | ||
utils_1.setAttribute(dom, attrName, attrs[attrName]); | ||
(0, utils_1.setAttribute)(dom, attrName, attrs[attrName]); | ||
} | ||
@@ -127,3 +127,3 @@ } | ||
var table = this.node && this.node.lastChild; | ||
var tableStyles = table ? utils_1.parseStyle(table.attrs.style) : {}; | ||
var tableStyles = table ? (0, utils_1.parseStyle)(table.attrs.style) : {}; | ||
var tableWidth = tableStyles.width || ''; | ||
@@ -130,0 +130,0 @@ if (tableWidth && !/%/.test(tableWidth)) { |
@@ -94,3 +94,3 @@ "use strict"; | ||
var $pos = view.state.doc.resolve(found.pos); | ||
var parentTable = utils_1.parentNode($pos, function (n) { return n.type.spec.tableRole === 'table'; }); | ||
var parentTable = (0, utils_1.parentNode)($pos, function (n) { return n.type.spec.tableRole === 'table'; }); | ||
if (parentTable === null) { | ||
@@ -97,0 +97,0 @@ return -1; |
@@ -30,2 +30,3 @@ import { ParseOptions, Node as ProseMirrorNode, Schema } from 'prosemirror-model'; | ||
* Creates a DocumentFragment from the given ProseMirrorNode. | ||
* | ||
* @param doc ProseMirrorNode | ||
@@ -32,0 +33,0 @@ * @returns DocumentFragment |
@@ -181,2 +181,3 @@ "use strict"; | ||
* Creates a DocumentFragment from the given ProseMirrorNode. | ||
* | ||
* @param doc ProseMirrorNode | ||
@@ -212,5 +213,5 @@ * @returns DocumentFragment | ||
var parseContent = function (content, schema, parseOptions) { | ||
var dom = exports.htmlToFragment(content); | ||
var dom = (0, exports.htmlToFragment)(content); | ||
validateTablesToPmSchema(dom); | ||
return exports.domToPmDoc(dom, schema, parseOptions); | ||
return (0, exports.domToPmDoc)(dom, schema, parseOptions); | ||
}; | ||
@@ -225,4 +226,4 @@ exports.parseContent = parseContent; | ||
var getHtml = function (state) { | ||
var fragment = exports.pmDocToFragment(state.doc); | ||
return exports.fragmentToHtml(fragment); | ||
var fragment = (0, exports.pmDocToFragment)(state.doc); | ||
return (0, exports.fragmentToHtml)(fragment); | ||
}; | ||
@@ -244,3 +245,3 @@ exports.getHtml = getHtml; | ||
.setSelection(new prosemirror_state_1.AllSelection(state.doc)) | ||
.replaceSelectionWith(exports.parseContent(content, state.schema, parseOptions)) | ||
.replaceSelectionWith((0, exports.parseContent)(content, state.schema, parseOptions)) | ||
.setMeta('commandName', command)); | ||
@@ -247,0 +248,0 @@ }; |
@@ -6,2 +6,3 @@ import { Node, NodeType } from 'prosemirror-model'; | ||
* Creates a table. | ||
* | ||
* @returns Node | ||
@@ -8,0 +9,0 @@ */ |
@@ -15,2 +15,3 @@ "use strict"; | ||
* Creates a table. | ||
* | ||
* @returns Node | ||
@@ -67,3 +68,3 @@ */ | ||
}); | ||
return prosemirror_tables_1.addRowBefore(state, cmdDispatch); | ||
return (0, prosemirror_tables_1.addRowBefore)(state, cmdDispatch); | ||
}; | ||
@@ -81,3 +82,3 @@ exports.addRowBefore = addRowBefore; | ||
}); | ||
return prosemirror_tables_1.addRowAfter(state, cmdDispatch); | ||
return (0, prosemirror_tables_1.addRowAfter)(state, cmdDispatch); | ||
}; | ||
@@ -101,3 +102,3 @@ exports.addRowAfter = addRowAfter; | ||
var colIndex = columnIndex(table, tr.selection); | ||
var colgroup = schema_1.parseStrColgroup(table.node.attrs[constants_1.colgroupAttr]); | ||
var colgroup = (0, schema_1.parseStrColgroup)(table.node.attrs[constants_1.colgroupAttr]); | ||
colgroup.insertBefore(colgroup.ownerDocument.createElement('col'), colgroup.children[colIndex + to]); | ||
@@ -108,3 +109,3 @@ tr.setNodeMarkup(table.pos, null, tslib_1.__assign(tslib_1.__assign({}, table.node.attrs), (_a = {}, _a[constants_1.colgroupAttr] = colgroup.outerHTML, _a))); | ||
var _a; | ||
var colgroup = schema_1.parseStrColgroup(table.node.attrs[constants_1.colgroupAttr]); | ||
var colgroup = (0, schema_1.parseStrColgroup)(table.node.attrs[constants_1.colgroupAttr]); | ||
colgroup.removeChild(colgroup.children[colIndex]); | ||
@@ -122,3 +123,3 @@ tr.setNodeMarkup(table.pos, null, tslib_1.__assign(tslib_1.__assign({}, table.node.attrs), (_a = {}, _a[constants_1.colgroupAttr] = colgroup.outerHTML, _a))); | ||
}); | ||
return prosemirror_tables_1.addColumnBefore(state, cmdDispatch); | ||
return (0, prosemirror_tables_1.addColumnBefore)(state, cmdDispatch); | ||
}; | ||
@@ -135,3 +136,3 @@ exports.addColumnBefore = addColumnBefore; | ||
}); | ||
return prosemirror_tables_1.addColumnAfter(state, cmdDispatch); | ||
return (0, prosemirror_tables_1.addColumnAfter)(state, cmdDispatch); | ||
}; | ||
@@ -151,4 +152,4 @@ exports.addColumnAfter = addColumnAfter; | ||
}); | ||
return prosemirror_tables_1.deleteColumn(state, cmdDispatch); | ||
return (0, prosemirror_tables_1.deleteColumn)(state, cmdDispatch); | ||
}; | ||
exports.deleteColumn = deleteColumn; |
import { EditorState } from 'prosemirror-state'; | ||
import { EditorView } from 'prosemirror-view'; | ||
import { DispatchFn } from './dispatchFn'; | ||
export declare type Command = (state: EditorState, dispatch: DispatchFn, view?: EditorView) => boolean | void; | ||
export type Command = (state: EditorState, dispatch: DispatchFn, view?: EditorView) => boolean | void; |
import { Transaction } from 'prosemirror-state'; | ||
export declare type DispatchFn = (tr: Transaction) => void; | ||
export type DispatchFn = (tr: Transaction) => void; |
@@ -1,1 +0,1 @@ | ||
export declare type Predicate<T = any> = (condition: T) => boolean; | ||
export type Predicate<T = any> = (condition: T) => boolean; |
@@ -63,3 +63,3 @@ import { Node, NodeType, ParseOptions, Schema, ResolvedPos } from 'prosemirror-model'; | ||
*/ | ||
export declare const expandToWordWrap: (command: any, options: any) => (state: any, dispatch: any, _view?: any) => any; | ||
export declare const expandToWordWrap: (command: any, options: any) => (state: any, dispatch: any) => any; | ||
export declare const parseStyle: (styleText: string | null) => { | ||
@@ -66,0 +66,0 @@ [x: string]: string; |
@@ -21,3 +21,3 @@ "use strict"; | ||
if (newValue) { | ||
filtered.push(styleToChange + ": " + newValue); | ||
filtered.push("".concat(styleToChange, ": ").concat(newValue)); | ||
} | ||
@@ -34,3 +34,3 @@ return { | ||
if (new RegExp('[^-]?' + styleType + ':').test(nodeAttrs.style || '')) { | ||
var style = exports.changeStylesString(nodeAttrs.style || '', { style: styleType, value: reAnyValue, newValue: value }).style; | ||
var style = (0, exports.changeStylesString)(nodeAttrs.style || '', { style: styleType, value: reAnyValue, newValue: value }).style; | ||
attrs = tslib_1.__assign(tslib_1.__assign({}, nodeAttrs), { style: style }); | ||
@@ -126,4 +126,4 @@ } | ||
var hasSameMarkup = function (dom1, dom2, schema, parseOptions) { | ||
var fragment1 = prosemirror_model_1.Fragment.from(source_1.parseContent(dom1, schema, parseOptions)); | ||
var fragment2 = prosemirror_model_1.Fragment.from(source_1.parseContent(dom2, schema, parseOptions)); | ||
var fragment1 = prosemirror_model_1.Fragment.from((0, source_1.parseContent)(dom1, schema, parseOptions)); | ||
var fragment2 = prosemirror_model_1.Fragment.from((0, source_1.parseContent)(dom2, schema, parseOptions)); | ||
return fragment1.eq(fragment2); | ||
@@ -164,3 +164,3 @@ }; | ||
if (!hasLeafs) { | ||
result = exports.getSelectionText(state); | ||
result = (0, exports.getSelectionText)(state); | ||
} | ||
@@ -274,4 +274,4 @@ } | ||
var expandToWordWrap = function (command, options) { | ||
return function (state, dispatch, _view) { | ||
var _a = exports.expandSelection(state, dispatch, options), cmdState = _a.state, cmdDispatch = _a.dispatch; | ||
return function (state, dispatch) { | ||
var _a = (0, exports.expandSelection)(state, dispatch, options), cmdState = _a.state, cmdDispatch = _a.dispatch; | ||
return command(options)(cmdState, cmdDispatch); | ||
@@ -291,6 +291,6 @@ }; | ||
var applyStyle = function (styleText, styleType, styleValue) { | ||
var styles = exports.parseStyle(styleText); | ||
var styles = (0, exports.parseStyle)(styleText); | ||
styles[styleType] = styleValue; | ||
var result = Object.keys(styles) | ||
.map(function (name) { return styles[name] ? name + ": " + styles[name] : null; }) | ||
.map(function (name) { return styles[name] ? "".concat(name, ": ").concat(styles[name]) : null; }) | ||
.filter(Boolean) | ||
@@ -302,3 +302,3 @@ .join('; '); | ||
var setStyleAttr = function (element, styleString) { | ||
var styles = exports.parseStyle(styleString); | ||
var styles = (0, exports.parseStyle)(styleString); | ||
for (var style in styles) { | ||
@@ -305,0 +305,0 @@ if (style && typeof element.style[style] !== 'undefined') { |
{ | ||
"name": "@progress/kendo-editor-common", | ||
"description": "Kendo UI TypeScript package exporting functions for Editor component", | ||
"version": "1.11.1", | ||
"version": "1.11.2-dev.202402200937", | ||
"keywords": [ | ||
@@ -20,4 +20,4 @@ "Kendo UI" | ||
"test": "jest", | ||
"lint": "gulp lint", | ||
"build-package": "gulp build-package build-es2015-bundle", | ||
"lint": "eslint .", | ||
"build-package": "gulp build-ts-package", | ||
"semantic-release": "semantic-release pre && semantic-prerelease publish --public && semantic-release post" | ||
@@ -28,8 +28,8 @@ }, | ||
"prosemirror-history": "1.3.2", | ||
"prosemirror-inputrules": "1.3.0", | ||
"prosemirror-inputrules": "1.4.0", | ||
"prosemirror-keymap": "1.2.2", | ||
"prosemirror-model": "1.19.3", | ||
"prosemirror-model": "1.19.4", | ||
"prosemirror-schema-list": "1.3.0", | ||
"prosemirror-state": "1.4.3", | ||
"prosemirror-view": "1.32.6", | ||
"prosemirror-view": "1.33.1", | ||
"prosemirror-dropcursor": "1.8.1", | ||
@@ -42,15 +42,21 @@ "prosemirror-gapcursor": "1.3.2", | ||
"devDependencies": { | ||
"@progress/kendo-typescript-tasks": "^10.0.17", | ||
"@telerik/semantic-prerelease": "^1.0.0", | ||
"@progress/kendo-typescript-tasks": "11.3.2", | ||
"@progress/semantic-prerelease": "^3.0.0", | ||
"@types/jasmine": "~2.2.0", | ||
"@types/jest": "^23.3.2", | ||
"core-js": "^2.2.2", | ||
"@typescript-eslint/eslint-plugin": "^7.0.1", | ||
"cz-conventional-changelog": "^1.1.5", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-jest": "^27.8.0", | ||
"eslint-plugin-jsdoc": "^48.1.0", | ||
"eslint-plugin-typescript": "^0.14.0", | ||
"ghooks": "^1.0.3", | ||
"gulp": "^4.0.0", | ||
"jest": "^23.6.0", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"jest-preset-typescript": "^1.0.1", | ||
"semantic-release": "^6.3.6", | ||
"ts-jest": "^23.1.4", | ||
"typescript": "~4.3.3", | ||
"ts-jest": "^29.1.2", | ||
"typescript": "~5.1.3", | ||
"typescript-eslint": "^7.0.1", | ||
"validate-commit-msg": "^1.1.1" | ||
@@ -82,3 +88,4 @@ }, | ||
"jest": { | ||
"preset": "jest-preset-typescript" | ||
"preset": "jest-preset-typescript", | ||
"testEnvironment": "jsdom" | ||
}, | ||
@@ -100,7 +107,7 @@ "repository": { | ||
}, | ||
"analyzeCommits": "@telerik/semantic-prerelease/analyzeCommits", | ||
"generateNotes": "@telerik/semantic-prerelease/generateNotes", | ||
"getLastRelease": "@telerik/semantic-prerelease/getLastRelease", | ||
"verifyConditions": "@telerik/semantic-prerelease/verifyConditions", | ||
"verifyRelease": "@telerik/semantic-prerelease/verifyRelease" | ||
"analyzeCommits": "@progress/semantic-prerelease/analyzeCommits", | ||
"generateNotes": "@progress/semantic-prerelease/generateNotes", | ||
"getLastRelease": "@progress/semantic-prerelease/getLastRelease", | ||
"verifyConditions": "@progress/semantic-prerelease/verifyConditions", | ||
"verifyRelease": "@progress/semantic-prerelease/verifyRelease" | ||
}, | ||
@@ -107,0 +114,0 @@ "files": [ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
1
80
14920
633192
20
183
+ Addedprosemirror-inputrules@1.4.0(transitive)
+ Addedprosemirror-model@1.19.4(transitive)
+ Addedprosemirror-view@1.33.1(transitive)
- Removedprosemirror-inputrules@1.3.0(transitive)
- Removedprosemirror-model@1.19.3(transitive)
- Removedprosemirror-view@1.32.6(transitive)
Updatedprosemirror-inputrules@1.4.0
Updatedprosemirror-model@1.19.4
Updatedprosemirror-view@1.33.1