@ones-editor/editor 0.0.8 → 0.0.9-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,6 +15,7 @@ export declare class TextColorItem extends TypedEmitter<ColorPaletteEvents> impl
15
15
  constructor(editor: OnesEditor);
16
16
  destroy(): void;
17
17
  handlePaletteClick: (type: 'color' | 'backgroundColor' | 'clearColor', value: number) => void;
18
+ setLatestColors: (type: 'color' | 'backgroundColor' | 'clearColor', value: number) => void;
18
19
  beforePopup: () => void;
19
20
  updatePaletteColor(colors: [number | null, number | null]): void;
20
21
  updateButtonColor(colors: [number | null, number | null]): void;
package/dist/index.js CHANGED
@@ -10288,24 +10288,6 @@ var __publicField = (obj, key, value) => {
10288
10288
  return createEditorSelectionRange(editor, { anchor: anchor2, focus });
10289
10289
  }
10290
10290
  const logger$3H = getLogger("range-from-point");
10291
- function getRangeFromExternal(editor, x, y) {
10292
- const container = editor.rootContainer;
10293
- const rect = container.getBoundingClientRect();
10294
- if (x < rect.left || x > rect.right) {
10295
- const elem = document.elementsFromPoint((rect.left + rect.right) / 2, y)[0];
10296
- if (elem) {
10297
- let block = getParentBlock(elem);
10298
- while (block && !isRootContainer(getParentContainer(block))) {
10299
- block = getParentBlockExcludeSelf(block);
10300
- }
10301
- if (block) {
10302
- const range = createBlockSimpleRange(editor, block, rect.left > x ? 0 : getBlockTextLength$4(editor, block));
10303
- return range;
10304
- }
10305
- }
10306
- }
10307
- return null;
10308
- }
10309
10291
  function getBlockRangeFromPoint(editor, pointX, pointY) {
10310
10292
  const yOffsets = [0, -8, 8];
10311
10293
  let x = pointX;
@@ -10334,10 +10316,7 @@ var __publicField = (obj, key, value) => {
10334
10316
  }
10335
10317
  }
10336
10318
  if (i === 0 && !editor.rootContainer.contains(elem)) {
10337
- const externalRange = getRangeFromExternal(editor, x, y);
10338
- if (externalRange) {
10339
- return externalRange;
10340
- }
10319
+ x = editor.rootContainer.getBoundingClientRect().left;
10341
10320
  }
10342
10321
  if (!editor.rootContainer.contains(elem)) {
10343
10322
  continue;
@@ -37062,6 +37041,8 @@ var __publicField = (obj, key, value) => {
37062
37041
  __publicField(this, "latestColors", [null, null]);
37063
37042
  __publicField(this, "handlePaletteClick", (type, value) => {
37064
37043
  this.emit("onClick", type, value);
37044
+ });
37045
+ __publicField(this, "setLatestColors", (type, value) => {
37065
37046
  if (type === "color" || type === "backgroundColor") {
37066
37047
  if (type === "color") {
37067
37048
  this.latestColors[0] = value;
@@ -59342,6 +59323,7 @@ ${codeText}
59342
59323
  const ClearColor = ["clearAll", "clearColor", "clearBackground"];
59343
59324
  editorRangeClearColor(this.editor, ClearColor[value], this.setEmptyTextBlockColor);
59344
59325
  }
59326
+ this.colorItem.setLatestColors(type, value);
59345
59327
  });
59346
59328
  __publicField(this, "getEmptyTextBlockColor", (editor, blockId) => {
59347
59329
  const attributes = this.getEmptyBlockTextAttributes(editor, blockId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "0.0.8",
3
+ "version": "0.0.9-beta.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",