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

Fix #2202 again #2450

Merged
merged 3 commits into from
Feb 29, 2024
Merged

Fix #2202 again #2450

merged 3 commits into from
Feb 29, 2024

Conversation

JiuqingSong
Copy link
Collaborator

#2202: Delete first entity causes second entity to be reloaded in Content Model editor

I made a change (#2389) to fix #2202 before. The fix is to delete the entity element from DOM tree when press DELETE or BACKSPACE so when write back Content Model, the deleted entity element won't bother the reuse algorithm.

However, this causes a problem. We deleted the entity element before adding undo snapshot from formatContentModel, so that when add undo snapshot before write back, the DOM tree is already changed, so an extra undo snapshot is added. When we want to undo the change to bring the entity back, we need to press Ctrl+Z twice.

In this change, I first revert the previous fix, then change the algorithm of reusing entity element. If the next element we are about to add into DOM tree is an entity, we will try to reuse it even if refNode is entity as well, since that case means the refNode entity is very likely to be deleted (moved away) from Content Model.

@JiuqingSong JiuqingSong merged commit 743de92 into master Feb 29, 2024
7 checks passed
@JiuqingSong JiuqingSong deleted the u/jisong/2202_2 branch February 29, 2024 17:51
ianeli1 added a commit that referenced this pull request Mar 1, 2024
* fix collapsed

* remove test

* fix list

* remove margins

* Workaround for no mouseUp event (#2423)

* Rename StandaloneEditor to Editor (#2416)

* Rename StandaloneEditor to Editor

* fix build

* add parameter

* fix conflicts

* fix selection

* Fix insertNode: Do not reselect if updateCursor is false (#2431)

* Bump ip from 1.1.5 to 1.1.9 (#2433)

Bumps [ip](https://github.com/indutny/node-ip) from 1.1.5 to 1.1.9.
- [Commits](indutny/node-ip@v1.1.5...v1.1.9)

---
updated-dependencies:
- dependency-name: ip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Outdent indented empty paragraph when pressing Backspace. (#2429)

* outdent on backspace

* Remove unneeded check

* fix test build

* handle Tab key for paragraph

* fix build

* fix build

* remove /lib

* disable list features

* save last focus

* Support adding options for exportContent (#2443)

* Set RootFontSize to SanitizingContext (#2445)

* init

* fix Build

* Check once if it is Rem Unit

* refactor

* fix build

* Fix #2435 (#2442)

* format with content model

* remove empty line

* Split contentDiv into physicalRoot and logicalRoot (#2441)

* Split contentDiv into physicalRoot and logicalRoot

* Fix failing test

* Fixed failing test harnesses

* Updated in response to PR comments

* Fix tests

* add unit test

* Fix dispose plugin issus in EditorAdapter (#2452)

* Fix #2202 again (#2450)

* Improve Entity State related API (#2444)

* Improve Entity State related API

* fix build and test

* add test

---------

Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com>

* Port Table edit plugin (#2358)

* Standalone Editor step 2

* Standalone Editor step 3

* improve

* Standalone Editor step 4

* Standalone Editor: Remove compatible enums from standalone editor

* improve

* Standalone Editor: Create new event types

* Port to new event system

* Revert "Port to new event system"

This reverts commit 60cf041.

* Port to new event system

* Improve

* fix build

* fix demo

* Fix buttons

* fix build

* fix build

* fix build

* plugin added to cm demo site

* pluginUtils imported

* IStandaloneEditor changes

* editTable can skip undo snapshot

* TableEditPlugin port start

* move D&D to folder

* add plugin to Standalone demo and remove old plugin

* demo fix

* rename D&D and fix import

* demo site changes

* rename selector to mover

* new plugin utils, organisation

* isMobileOrTablet

* cleanup

* normalise width too

* remove onShowHelperElement, fix containment, instancing, others

* implement cell resizer

* fix type import

* fix selection

* fix imports

* fix instanceof, use formatTableWithContentModel, getDOMHelper

* fix merge

* small fix

* fix table resize functionality

* fix merge

* fix import

* fix dependency

* fix exports

* merge fix

* export MIN_WIDTH

* fix resizers

* add check

* fix color

* fix instanceof

* change IStandaloneEditor to IEditor

* fix export const

* rename const

* fix cell resizer, add ids

* add tests

* fix build issues

---------

Co-authored-by: Jiuqing Song <jisong@microsoft.com>

* Port ShortcutPlugin (#2427)

* Port ShortcutPlugin

* fix build

* add test

* add test

* add test

* fix build

* fix build

* improve

* fix comment

* fix test

* Add option to configure the default paste type (#2457)

* init

* Add tests

* Fix build

* Bump Versions

* Remove Space

* Fix 258837 and 257626 (#2459)

* Remove Bg Color from block on Merge Paste (#2458)

* init

* Remove unneeded code

* address comment

* remove empty line

* Fix Version Numbers

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Júlia Roldi <juliaroldi@microsoft.com>
Co-authored-by: Julia Roldi <87443959+juliaroldi@users.noreply.github.com>
Co-authored-by: Jiuqing Song <jisong@microsoft.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bryan Valverde U <bvalverde@microsoft.com>
Co-authored-by: florian-msft <87671048+florian-msft@users.noreply.github.com>
Co-authored-by: Andres-CT98 <107568016+Andres-CT98@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete first entity causes second entity to be reloaded in Content Model editor
2 participants