plate icon indicating copy to clipboard operation
plate copied to clipboard

Should remove deleteFragment from withList

Open pubuzhixing8 opened this issue 4 years ago • 5 comments

The problem of deleting multi-level lists has been solved by the slate library,PR: https://github.com/ianstormtaylor/slate/pull/3825 It is exactly the same as the solution in my PR: https://github.com/udecode/slate-plugins/pull/694 So, I think that the overriding logic related to list deletion can be completely removed:

  1. remove overrided deleteFragment function for withList
  2. remove common/src/transforms/deleteFragment.ts
  3. remove common/src/transforms/mergeNodes.ts
  4. remove common/src/queries/hasSingleChild.ts

@zbeyens

pubuzhixing8 avatar Jun 17 '21 14:06 pubuzhixing8

Thanks for the update, I'll give a try!

zbeyens avatar Jun 17 '21 15:06 zbeyens

@pubuzhixing8 I don't know if removing getListDeleteFragment will allow us to completely remove deleteFragment and its related logic as it's still in use here and here.

cmditch avatar Jun 20 '21 17:06 cmditch

@cmditch I understand your question. Currently core function deleteFragment has no special responsibilities compared to editor.deleteFragment,so these two places can be replaced with editor.deleteFragment first. In fact, these two codes use(here and here) are related to the logic of list deleteBackward, and the logic of list deleteBackward can be further optimized.

pubuzhixing8 avatar Jun 22 '21 06:06 pubuzhixing8

Unfortunately, slate-plugins has not yet upgraded slate to 0.63.0

pubuzhixing8 avatar Jun 26 '21 04:06 pubuzhixing8

We might be able to revisit this now that plate has bumped the slate dep.

Note also deleteFragmentList is seeing some odd behavior. https://github.com/udecode/plate/issues/1256

cmditch avatar Dec 01 '21 00:12 cmditch