Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16.1.0 next #262

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
78bcc2b
fix(core): isTargetInsideVoid add suppressThrow config to avoid throw…
pubuzhixing8 Mar 13, 2024
078549e
build: release 16.1.0-next.16
pubuzhixing8 Mar 13, 2024
a43d313
fix(core): execute detectChanges after create black card component
pubuzhixing8 Mar 13, 2024
eae74b4
build: release 16.1.0-next.17
pubuzhixing8 Mar 13, 2024
46d0659
fix(list-render): add afterViewInit method to handle performance issue
pubuzhixing8 Mar 16, 2024
aa2c453
build: release 16.1.0-next.18
pubuzhixing8 Mar 16, 2024
52fcaa1
feat(core): prevent move selection when selection is in left or right…
huanhuanwa Mar 18, 2024
edd539d
fix(list-render): update NODE_TO_INDEX and NODE_TO_PARENT when diffRe…
pubuzhixing8 Mar 18, 2024
92f4d11
build: release 16.1.0-next.19
pubuzhixing8 Mar 18, 2024
f3395b1
fix(core): invoke deleteBackward manually as inline void element
pubuzhixing8 Mar 21, 2024
0ccbf4f
build: release 16.1.0-next.20
pubuzhixing8 Mar 21, 2024
6f9068e
chore: exit pre mode
pubuzhixing8 Mar 26, 2024
26dc59f
build: release 16.1.0
pubuzhixing8 Mar 26, 2024
3eea7be
fix(core): isTargetInsideVoid add suppressThrow config to avoid throw…
pubuzhixing8 Mar 13, 2024
19d8d8d
build: release 16.1.0-next.16
pubuzhixing8 Mar 13, 2024
3ec1a9b
fix(core): execute detectChanges after create black card component
pubuzhixing8 Mar 13, 2024
82a72c2
build: release 16.1.0-next.17
pubuzhixing8 Mar 13, 2024
9c532f5
fix(list-render): add afterViewInit method to handle performance issue
pubuzhixing8 Mar 16, 2024
d61b3de
build: release 16.1.0-next.18
pubuzhixing8 Mar 16, 2024
a829d51
build: release 16.1.0-next.19
pubuzhixing8 Mar 18, 2024
a9c2bf0
build: release 16.1.0-next.20
pubuzhixing8 Mar 21, 2024
2170959
chore: exit pre mode
pubuzhixing8 Mar 26, 2024
f594445
build: release 16.1.0
pubuzhixing8 Mar 26, 2024
465a28f
Merge branch '16.1.0-next' of github.com:worktile/slate-angular into …
pubuzhixing8 Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/calm-jokes-shout.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/chatty-worms-melt.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/cold-dryers-carry.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/cyan-jars-cry.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/famous-feet-bow.md

This file was deleted.

10 changes: 0 additions & 10 deletions .changeset/five-lies-vanish.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/happy-dancers-fix.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/hip-planes-grin.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/honest-wolves-mate.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/large-ladybugs-poke.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/modern-moose-pull.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/modern-shoes-hear.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/nice-parrots-rest.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/ninety-snakes-yawn.md

This file was deleted.

29 changes: 0 additions & 29 deletions .changeset/pre.json

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/rare-snails-join.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/red-poets-grin.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/shy-weeks-report.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/silly-pillows-mate.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/slimy-cycles-share.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/strange-flowers-suffer.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/stupid-files-wait.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tender-cobras-walk.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/twenty-geckos-roll.md

This file was deleted.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 101 additions & 0 deletions packages/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,106 @@
# Changelog

## 16.1.0

### Minor Changes

- [#242](https://github.com/worktile/slate-angular/pull/242) [`bcfe6ab`](https://github.com/worktile/slate-angular/commit/bcfe6abfde24189db8040459f0bfbaa47dce911a) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - initialize list render and leaves render to optimized rendering performance
deprecated container

- [`4b7cbb6`](https://github.com/worktile/slate-angular/commit/4b7cbb6bcaed1ef1aaa9f51efc24fbb264bc9e4e) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - support suppressThrow in toSlateRange/toSlatePoint/isLeafInEditor to check domSelection is valid

- [#246](https://github.com/worktile/slate-angular/pull/246) [`2fa7dd7`](https://github.com/worktile/slate-angular/commit/2fa7dd72d29c18fbbae0998ca94c3800c75839fd) Thanks [@Bricklou](https://github.com/Bricklou)! - Update dependencies (like slate) to latest versions

- [#242](https://github.com/worktile/slate-angular/pull/242) [`fface3b`](https://github.com/worktile/slate-angular/commit/fface3b4fc907b7f569a06d23a2ebf22bf2803ba) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - improve isLineBreakEmptyString、forEachMovedItem、setBaseAndExtent performance issues

### Patch Changes

- [#250](https://github.com/worktile/slate-angular/pull/250) [`40f4214`](https://github.com/worktile/slate-angular/commit/40f4214e86ad60b30ce7cf9a1c4cf6287e88823d) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - support custom elements to set the position of children elements

- [`f3395b1`](https://github.com/worktile/slate-angular/commit/f3395b1937979236cade5d510c4ed62f1bfaa06a) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - the beforeinput event will not fire while use press `deleteBackward` on void block element since remove contentEditable form void text element, so invoke deleteBackward manually as inline void element

- [`5d7d22d`](https://github.com/worktile/slate-angular/commit/5d7d22d5fe11cf2a666b4b5dc3d5613b83035f09) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - add hasAfterContextChange that the timing is after detectChanges

- [`b494e6d`](https://github.com/worktile/slate-angular/commit/b494e6d8587562b0dae5d356c9acbabb8f714fa9) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - Update README:

1. depend on slate@0.101.5
2. remove <slate-leaves></slate-leaves> from template of custom text component

- [`4ef6370`](https://github.com/worktile/slate-angular/commit/4ef6370b65494715e2190afab64d46ecf11bfd14) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - Fix error when triple-clicking a word preceding a `contenteditable="false"` DOM node in Chrome
refer to: https://github.com/ianstormtaylor/slate/pull/5343

- [`6eee752`](https://github.com/worktile/slate-angular/commit/6eee752297d0e447e9849e29a8c64b3691929bcc) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - remove path from SlateElementContext

- [`db55c5c`](https://github.com/worktile/slate-angular/commit/db55c5c958de8d473504cc5a391d9098f1d178d7) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - support overridable methods expanded to control the expanded or collapsed state of children view, such as toggle-list plugin

- [`78bcc2b`](https://github.com/worktile/slate-angular/commit/78bcc2b539debcb69c55f917ddd7f4a526614452) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - isTargetInsideVoid add suppressThrow config

- [`f122a37`](https://github.com/worktile/slate-angular/commit/f122a3770ea0851688ba4b7292e7c05b496b36c8) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - update block card append timing

- [`f1e3831`](https://github.com/worktile/slate-angular/commit/f1e3831d107defbc0e1c4ca9a2e9fb035fa08ea3) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - add contenteditable = 'false' when element is void(Revert recent logic changes)

- [`0657338`](https://github.com/worktile/slate-angular/commit/065733809960ec3c50c1c24f5bb92f1944760bfc) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - use parent element of outlet to insert fragment

- [`34a268a`](https://github.com/worktile/slate-angular/commit/34a268a4ce2291432c4951b86d2c0ff1d6748fe3) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - get template's root nodes by data-slate-node and data-slate-leaf attribute to avoid operating other HTMLElement

- [`fa62932`](https://github.com/worktile/slate-angular/commit/fa629326a82c4245f5d2c3d1ce99ed734c5f418b) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - fix query void text error

- [`52fcaa1`](https://github.com/worktile/slate-angular/commit/52fcaa1f7cb6a680c02cdbc1a96059e30e8f1b53) Thanks [@huanhuanwa](https://github.com/huanhuanwa)! - prevent move selection when selection is in left or right cursor when click up

- [`b4f5020`](https://github.com/worktile/slate-angular/commit/b4f5020e1406cf147f5cc7c9b35ac11d5486dcde) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - export throttle utils

- [`e59cc1d`](https://github.com/worktile/slate-angular/commit/e59cc1db93672b9379b0937f72e21b86a2d28ead) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - should invoke initialize when previous children is empty

- [`0c59f49`](https://github.com/worktile/slate-angular/commit/0c59f492371b901c3bb7791b9a2bf2cc166e42af) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - cancel throttleRAF for setBaseAndExtent

- [`ae78be8`](https://github.com/worktile/slate-angular/commit/ae78be824c2a6fb03ea88c3c9920ff122da1451d) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - update detect changes timing when set context

- [`a43d313`](https://github.com/worktile/slate-angular/commit/a43d313d7bcfdfa277a2093d2687d32685561264) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - execute detectChanges after create black card component to avoid incorrect render timing of left and right caret

- [`edd539d`](https://github.com/worktile/slate-angular/commit/edd539d6abd59787c2c9c65ca5fe0effddfd31e1) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - update NODE_TO_INDEX and NODE_TO_PARENT when diffResult is undefined

- [#253](https://github.com/worktile/slate-angular/pull/253) [`fa01d81`](https://github.com/worktile/slate-angular/commit/fa01d81fbfd3c932cb4147d8175da46ff42cca29) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - handle triple-click
remove the attribute of editable='false' in void element to void strange behavior when click before image element
refer to:
https://github.com/ianstormtaylor/slate/pull/4588
https://github.com/ianstormtaylor/slate/pull/4965

- [`46d0659`](https://github.com/worktile/slate-angular/commit/46d0659f932923224af411798b57255f7003327e) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - add afterViewInit method to handle performance issue
set contenteditable will cause performance issue during dynamic created component execute detectChanges

## 16.1.0-next.20

### Patch Changes

- [`f3395b1`](https://github.com/worktile/slate-angular/commit/f3395b1937979236cade5d510c4ed62f1bfaa06a) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - the beforeinput event will not fire while use press `deleteBackward` on void block element since remove contentEditable form void text element, so invoke deleteBackward manually as inline void element

## 16.1.0-next.19

### Patch Changes

- [`52fcaa1`](https://github.com/worktile/slate-angular/commit/52fcaa1f7cb6a680c02cdbc1a96059e30e8f1b53) Thanks [@huanhuanwa](https://github.com/huanhuanwa)! - prevent move selection when selection is in left or right cursor when click up

- [`edd539d`](https://github.com/worktile/slate-angular/commit/edd539d6abd59787c2c9c65ca5fe0effddfd31e1) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - update NODE_TO_INDEX and NODE_TO_PARENT when diffResult is undefined

## 16.1.0-next.18

### Patch Changes

- [`46d0659`](https://github.com/worktile/slate-angular/commit/46d0659f932923224af411798b57255f7003327e) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - add afterViewInit method to handle performance issue
set contenteditable will cause performance issue during dynamic created component execute detectChanges

## 16.1.0-next.17

### Patch Changes

- [`a43d313`](https://github.com/worktile/slate-angular/commit/a43d313d7bcfdfa277a2093d2687d32685561264) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - execute detectChanges after create black card component to avoid incorrect render timing of left and right caret

## 16.1.0-next.16

### Patch Changes

- [`78bcc2b`](https://github.com/worktile/slate-angular/commit/78bcc2b539debcb69c55f917ddd7f4a526614452) Thanks [@pubuzhixing8](https://github.com/pubuzhixing8)! - isTargetInsideVoid add suppressThrow config

## 16.1.0-next.15

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slate-angular",
"version": "16.1.0-next.15",
"version": "16.1.0",
"description": "Angular view layer for Slate",
"author": "pubuzhixing <pubuzhixing@gmail.com>",
"homepage": "https://github.com/worktile/slate-angular#readme",
Expand Down
4 changes: 2 additions & 2 deletions packages/src/components/editable/editable.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1419,8 +1419,8 @@ const hasTarget = (editor: AngularEditor, target: EventTarget | null): target is
*/

const isTargetInsideVoid = (editor: AngularEditor, target: EventTarget | null): boolean => {
const slateNode = hasTarget(editor, target) && AngularEditor.toSlateNode(editor, target);
return Element.isElement(slateNode) && Editor.isVoid(editor, slateNode);
const slateNode = hasTarget(editor, target) && AngularEditor.toSlateNode(editor, target, { suppressThrow: true });
return slateNode && Element.isElement(slateNode) && Editor.isVoid(editor, slateNode);
};

const hasStringTarget = (domSelection: DOMSelection) => {
Expand Down
5 changes: 0 additions & 5 deletions packages/src/components/text/void-text.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { SlateLeaves } from '../leaves/leaves.component';
template: ``,
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'[attr.contenteditable]': 'isLeafBlock',
'data-slate-spacer': 'true',
class: 'slate-spacer',
'data-slate-node': 'text'
Expand All @@ -17,17 +16,13 @@ import { SlateLeaves } from '../leaves/leaves.component';
imports: [SlateLeaves]
})
export class SlateVoidText extends BaseTextComponent implements OnInit, OnChanges {
isLeafBlock: boolean;

ngOnInit() {
this.isLeafBlock = AngularEditor.isLeafBlock(this.viewContext.editor, this.context.parent);
super.ngOnInit();
}

ngOnChanges() {
if (!this.initialized) {
return;
}
this.isLeafBlock = AngularEditor.isLeafBlock(this.viewContext.editor, this.context.parent);
}
}
7 changes: 7 additions & 0 deletions packages/src/view/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ export class BaseElementComponent<T extends Element = Element, K extends Angular
}
}

afterViewInit() {
if (this._context.contentEditable !== undefined) {
this.nativeElement.setAttribute('contenteditable', this._context.contentEditable + '');
}
this.listRender.afterViewInit();
}

updateWeakMap() {
NODE_TO_ELEMENT.set(this.element, this.nativeElement);
ELEMENT_TO_NODE.set(this.nativeElement, this.element);
Expand Down
2 changes: 1 addition & 1 deletion packages/src/view/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface SlateElementContext<T extends Element = Element> {
selection: Range | null;
decorations: Range[];
attributes: SlateElementAttributes;
contentEditable?: boolean;
decorate: (entry: NodeEntry) => Range[];
readonly: boolean;
}
Expand All @@ -55,7 +56,6 @@ export interface SlateElementAttributes {
'data-slate-void'?: boolean;
'data-slate-inline'?: boolean;
'data-slate-key'?: string;
'contenteditable'?: boolean;
dir?: 'rtl';
}

Expand Down
Loading