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

@textbus/core

Package Overview
Dependencies
Maintainers
1
Versions
345
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@textbus/core - npm Package Compare versions

Comparing version 2.0.0-alpha.42 to 2.0.0-alpha.43

1

bundles/model/content.d.ts

@@ -15,2 +15,3 @@ import { ComponentInstance, ComponentLiteral } from './component';

getContentAtIndex(index: number): string | ComponentInstance<import("./component").ComponentMethods, any>;
toGrid(): number[];
}

@@ -123,3 +123,13 @@ /**

}
toGrid() {
const splitPoints = new Set();
let index = 0;
splitPoints.add(index);
this.data.forEach(i => {
index += i.length;
splitPoints.add(index);
});
return [...splitPoints].sort((a, b) => a - b);
}
}
//# sourceMappingURL=content.js.map

2

bundles/model/element.d.ts

@@ -28,3 +28,3 @@ declare const parentNode: unique symbol;

tagName: string;
static createElement(tagName: string | VElementRenderFn, attrs: VElementOptions, ...children: VElementJSXChildNode[] | VElementJSXChildNode[][]): VElement;
static createElement(tagName: string | VElementRenderFn, attrs: VElementOptions | null, ...children: VElementJSXChildNode[] | VElementJSXChildNode[][]): VElement;
get parentNode(): VElement | null;

@@ -31,0 +31,0 @@ get children(): (VTextNode | VElement)[];

@@ -83,2 +83,3 @@ import { AttributeFormatter, BlockFormatter, Formatter, InlineFormatter } from './formatter';

discard(formatter: Formatter, startIndex: number, endIndex: number): this;
toGrid(): number[];
toJSON(): FormatLiteral;

@@ -85,0 +86,0 @@ toTree(startIndex: number, endIndex: number): FormatTree;

@@ -194,2 +194,14 @@ import { FormatType } from './formatter';

}
toGrid() {
const splitPoints = new Set();
splitPoints.add(0);
splitPoints.add(this.slot.length);
this.map.forEach(ranges => {
ranges.forEach(item => {
splitPoints.add(item.startIndex);
splitPoints.add(item.endIndex);
});
});
return [...splitPoints].sort((a, b) => a - b);
}
toJSON() {

@@ -196,0 +208,0 @@ const json = {};

@@ -19,2 +19,7 @@ import { Draft } from 'immer';

}
export interface DeltaInsert {
insert: string | ComponentInstance;
formats: Formats;
}
export declare type DeltaLite = DeltaInsert[];
export declare const placeholder = "\u200B";

@@ -134,2 +139,11 @@ /**

toJSON(): SlotLiteral<T>;
/**
* 将插槽数据转换为 delta 表示
*/
toDelta(): DeltaLite;
/**
* 根据 delta 插入内容
* @param delta
*/
insertDelta(delta: DeltaLite): DeltaLite;
private applyFormats;

@@ -136,0 +150,0 @@ private static createActionByFormat;

@@ -473,2 +473,45 @@ import { produce } from 'immer';

}
/**
* 将插槽数据转换为 delta 表示
*/
toDelta() {
if (this.length === 0) {
return [];
}
const formatGrid = this.format.toGrid();
const contentGrid = this.content.toGrid();
const gridSet = new Set([...formatGrid, ...contentGrid]);
const grid = [...gridSet].sort((a, b) => a - b);
const deltaList = [];
let startIndex = grid.shift();
while (grid.length) {
const endIndex = grid.shift();
deltaList.push({
insert: this.content.slice(startIndex, endIndex)[0],
formats: this.format.extract(startIndex, endIndex).toArray().map(i => {
return [i.formatter, i.value];
})
});
startIndex = endIndex;
}
return deltaList;
}
/**
* 根据 delta 插入内容
* @param delta
*/
insertDelta(delta) {
while (delta.length) {
const first = delta[0];
// TODO 这里插入的还有组件,要修复类型
const is = this.insert(first.insert, first.formats);
if (is) {
delta.shift();
}
else {
break;
}
}
return delta;
}
applyFormats(formats, startIndex, offset) {

@@ -475,0 +518,0 @@ formats.forEach(keyValue => {

{
"name": "@textbus/core",
"version": "2.0.0-alpha.42",
"version": "2.0.0-alpha.43",
"description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",

@@ -43,3 +43,3 @@ "main": "./bundles/public-api.js",

},
"gitHead": "81f934ca076d258571ba7c5babdb6b1ab71e4760"
"gitHead": "9c0f96ced4836b54cd96082895234f1ec4e91d8e"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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