Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-engine

Package Overview
Dependencies
Maintainers
1
Versions
662
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-engine - npm Package Compare versions

Comparing version 0.0.0-nightly-20230713.0 to 0.0.0-nightly-20230714.0

4

package.json
{
"name": "@ckeditor/ckeditor5-engine",
"version": "0.0.0-nightly-20230713.0",
"version": "0.0.0-nightly-20230714.0",
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.",

@@ -26,3 +26,3 @@ "keywords": [

"dependencies": {
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20230713.0",
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20230714.0",
"lodash-es": "^4.17.15"

@@ -29,0 +29,0 @@ },

@@ -875,4 +875,6 @@ /**

for (const value of range) {
// If the item is an object, we don't want to get attributes from its children.
// If the item is an object, we don't want to get attributes from its children...
if (value.item.is('element') && schema.isObject(value.item)) {
// ...but collect attributes from inline object.
attrs = getTextAttributes(value.item, schema);
break;

@@ -961,3 +963,4 @@ }

for (const [key, value] of node.getAttributes()) {
if (schema.checkAttribute('$text', key)) {
if (schema.checkAttribute('$text', key) &&
schema.getAttributeProperties(key).copyFromObject !== false) {
attributes.push([key, value]);

@@ -964,0 +967,0 @@ }

@@ -1172,2 +1172,12 @@ /**

copyOnEnter?: boolean;
/**
* Indicates that given attribute should be preserved while replacing the element.
*/
copyOnReplace?: boolean;
/**
* Indicates that given text attribute should be copied from an inline object to the next inserted inline content.
*
* @default true
*/
copyFromObject?: boolean;
[name: string]: unknown;

@@ -1174,0 +1184,0 @@ }

@@ -101,5 +101,5 @@ /**

/**
* A set of encountered raw content DOM nodes. It is used for preventing left trimming of the following text node.
* Matcher for inline object view elements. This is an extension of a simple {@link #inlineObjectElements} array of element names.
*/
private readonly _encounteredRawContentDomNodes;
private readonly _inlineObjectElementMatcher;
/**

@@ -273,5 +273,6 @@ * Creates a DOM converter.

* @param options See {@link module:engine/view/domconverter~DomConverter#domToView} options parameter.
* @param inlineNodes An array that will be populated with inline nodes. It's used internally for whitespace processing.
* @returns View nodes.
*/
domChildrenToView(domElement: DomElement, options: Parameters<DomConverter['domToView']>[1]): IterableIterator<ViewNode>;
domChildrenToView(domElement: DomElement, options?: Parameters<DomConverter['domToView']>[1], inlineNodes?: Array<ViewNode>): IterableIterator<ViewNode>;
/**

@@ -465,2 +466,13 @@ * Converts DOM selection to view {@link module:engine/view/selection~Selection}.

/**
* Registers a {@link module:engine/view/matcher~MatcherPattern} for inline object view elements.
*
* This is affecting how {@link module:engine/view/domconverter~DomConverter#domToView} and
* {@link module:engine/view/domconverter~DomConverter#domChildrenToView} process DOM nodes.
*
* This is an extension of a simple {@link #inlineObjectElements} array of element names.
*
* @param pattern Pattern matching a view element which should be treated as an inline object.
*/
registerInlineObjectMatcher(pattern: MatcherPattern): void;
/**
* Returns the block {@link module:engine/view/filler filler} node based on the current {@link #blockFillerMode} setting.

@@ -478,2 +490,20 @@ */

/**
* Internal generator for {@link #domToView}. Also used by {@link #domChildrenToView}.
* Separates DOM nodes conversion from whitespaces processing.
*
* @param domNode DOM node or document fragment to transform.
* @param inlineNodes An array of recently encountered inline nodes truncated to the block element boundaries.
* Used later to process whitespaces.
*/
private _domToView;
/**
* Internal helper that walks the list of inline view nodes already generated from DOM nodes
* and handles whitespaces and NBSPs.
*
* @param domParent The DOM parent of the given inline nodes. This should be a document fragment or
* a block element to whitespace processing start cleaning.
* @param inlineNodes An array of recently encountered inline nodes truncated to the block element boundaries.
*/
private _processDomInlineNodes;
/**
* Takes text data from a given {@link module:engine/view/text~Text#data} and processes it so

@@ -504,32 +534,2 @@ * it is correctly displayed in the DOM.

/**
* Takes text data from native `Text` node and processes it to a correct {@link module:engine/view/text~Text view text node} data.
*
* Following changes are done:
*
* * multiple whitespaces are replaced to a single space,
* * space at the beginning of a text node is removed if it is the first text node in its container
* element or if the previous text node ends with a space character,
* * space at the end of the text node is removed if there are two spaces at the end of a node or if next node
* starts with a space or if it is the last text node in its container
* * nbsps are converted to spaces.
*
* @param node DOM text node to process.
* @returns Processed data.
*/
private _processDataFromDomText;
/**
* Helper function which checks if a DOM text node, preceded by the given `prevNode` should
* be trimmed from the left side.
*
* @param prevNode Either DOM text or `<br>` or one of `#inlineObjectElements`.
*/
private _checkShouldLeftTrimDomText;
/**
* Helper function which checks if a DOM text node, succeeded by the given `nextNode` should
* be trimmed from the right side.
*
* @param nextNode Either DOM text or `<br>` or one of `#inlineObjectElements`.
*/
private _checkShouldRightTrimDomText;
/**
* Helper function. For given {@link module:engine/view/text~Text view text node}, it finds previous or next sibling

@@ -544,25 +544,9 @@ * that is contained in the same container element. If there is no such sibling, `null` is returned.

/**
* Helper function. For the given text node, it finds the closest touching node which is either
* a text, `<br>` or an {@link #inlineObjectElements inline object}.
*
* If no such node is found, `null` is returned.
*
* For instance, in the following DOM structure:
*
* ```html
* <p>foo<b>bar</b><br>bom</p>
* ```
*
* * `foo` doesn't have its previous touching inline node (`null` is returned),
* * `foo`'s next touching inline node is `bar`
* * `bar`'s next touching inline node is `<br>`
*
* This method returns text nodes and `<br>` elements because these types of nodes affect how
* spaces in the given text node need to be converted.
* Returns `true` if a DOM node belongs to {@link #blockElements}. `false` otherwise.
*/
private _getTouchingInlineDomNode;
private _isBlockDomElement;
/**
* Returns `true` if a DOM node belongs to {@link #blockElements}. `false` otherwise.
* Returns `true` if a view node belongs to {@link #blockElements}. `false` otherwise.
*/
private _isBlockElement;
private _isBlockViewElement;
/**

@@ -569,0 +553,0 @@ * Returns `true` if a DOM node belongs to {@link #inlineObjectElements}. `false` otherwise.

@@ -79,3 +79,3 @@ /**

*/
export declare function startsWithFiller(domNode: Node): boolean;
export declare function startsWithFiller(domNode: Node | string): boolean;
/**

@@ -105,3 +105,3 @@ * Checks if the text node contains only the {@link module:engine/view/filler~INLINE_FILLER inline filler}.

*/
export declare function getDataWithoutFiller(domText: Text): string;
export declare function getDataWithoutFiller(domText: Text | string): string;
/**

@@ -108,0 +108,0 @@ * Assign key observer which move cursor from the end of the inline filler to the beginning of it when

@@ -89,2 +89,5 @@ /**

export function startsWithFiller(domNode) {
if (typeof domNode == 'string') {
return domNode.substr(0, INLINE_FILLER_LENGTH) === INLINE_FILLER;
}
return isText(domNode) && (domNode.data.substr(0, INLINE_FILLER_LENGTH) === INLINE_FILLER);

@@ -119,8 +122,7 @@ }

export function getDataWithoutFiller(domText) {
const data = typeof domText == 'string' ? domText : domText.data;
if (startsWithFiller(domText)) {
return domText.data.slice(INLINE_FILLER_LENGTH);
return data.slice(INLINE_FILLER_LENGTH);
}
else {
return domText.data;
}
return data;
}

@@ -127,0 +129,0 @@ /**

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc