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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for adding and removing roots from multi-root editor after it was initialized #13388

Closed
scofalik opened this issue Feb 3, 2023 · 4 comments 路 Fixed by #13667
Closed

Allow for adding and removing roots from multi-root editor after it was initialized #13388

scofalik opened this issue Feb 3, 2023 · 4 comments 路 Fixed by #13667
Assignees
Labels
package:editor-multi-root squad:collaboration Issue to be handled by the Collaboration team. support:2 An issue reported by a commercially licensed client. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).

Comments

@scofalik
Copy link
Contributor

scofalik commented Feb 3, 2023

馃摑 Provide a description of the new feature

Currently, the roots' structure for multi-root is static, i.e., new roots cannot be added after the editor was initialized. Similarly, already exisiting roots cannot be removed.

This makes multi-roots very limiting in how they can be used.

Some important notes:

  • This solution should work in real-time collaboration. If a remote client creates a root, all other connected clients should be appropriately updated.
  • Adding / removing roots should work well with undo. In perfect scenario, you would be able to decide if creating a root is undoable or not, as the expected result may vary from application to application.

Related ticket / duplicates: #12235, #6291

@scofalik scofalik added type:feature This issue reports a feature request (an idea for a new functionality or a missing option). squad:collaboration Issue to be handled by the Collaboration team. labels Feb 3, 2023
@scofalik scofalik self-assigned this Feb 3, 2023
@CKEditorBot CKEditorBot added the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label Feb 3, 2023
@Inviz
Copy link
Contributor

Inviz commented Feb 3, 2023

new roots can be added, but can't be removed. Additionally detaching root from dom element does not detach observers

@Inviz
Copy link
Contributor

Inviz commented Feb 3, 2023

#13141 here's reported issue

@scofalik
Copy link
Contributor Author

scofalik commented Feb 3, 2023

Thanks for bringing up this issue, I haven't seen it while searching for "multi-root" keyword.

We want to simplify this process, so that multi-root feels natural and there's API that will do most of the work for you.

@Inviz
Copy link
Contributor

Inviz commented Feb 3, 2023

i'm super excite about it. we have to make a lot of workarounds, e.g. hiding roots instead of deleting them. it's pretty painful

@CKEditorBot CKEditorBot added status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. labels Mar 3, 2023
scofalik added a commit that referenced this issue Mar 27, 2023
Feature (engine): Introduced `model.Writer#addRoot()` and `model.Writer#detachRoot()`. Model roots can now be dynamically added to or detached from the document. All content gets removed from a detached root, and new content cannot be inserted, as long as the root is detached. Closes #13388.

Feature (engine): Introduced `Differ.getChangedRoots()` which returns roots added or detached since last differ reset. `Differ#isEmpty` and `Differ#hasDataChanges()` will return `true` if a root was added or detached.

Other: Introduced `Observer#stopObserving()` to allow for proper removal of DOM editable elements from the editor.

Other (ui): Introduced `EditorUI#removeEditableElement()`.

Other (engine): `model.Document#getRootNames()` now returns only attached roots by default. `includeDetached` parameter was introduced to enable returning detached roots as well.

Other (engine): Introduced `RootOperation`.

Other (engine): `model.DocumentFragment#isAttached` was introduced for compatibility reasons. It always returns `false`.

Internal (multi-root-editor): Introduced API which allows for adding and removing roots and editable areas.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Mar 27, 2023
@CKEditorBot CKEditorBot added this to the iteration 61 milestone Mar 27, 2023
@lslowikowska lslowikowska added the support:2 An issue reported by a commercially licensed client. label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:editor-multi-root squad:collaboration Issue to be handled by the Collaboration team. support:2 An issue reported by a commercially licensed client. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants