ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Docs issue report from "features/collaboration/comments/comments-outside-editor.html"

Open ryanj-openquire opened this issue 1 year ago • 3 comments

Origin URL

https://ckeditor.com/docs/ckeditor5/41.3.0/features/collaboration/comments/comments-outside-editor.html

Project version

41.3.0

Is the information outdated? How?

The code samples show devs how to reach into components to manually update views. This seems a bit hacky, and likely prone to breakage in the future. I discovered that by simply calling attachTo on the thread returned via addCommentThread worked great.

Is there something missing in the guide? What is it?

No response

Is there anything else you would like to add?

No response

User agent

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:126.0) Gecko/20100101 Firefox/126.0

ryanj-openquire avatar Jun 11 '24 18:06 ryanj-openquire

Hi @ryanj-openquire 

Could you please more preciesly specify which part of the documentation looks hacky, and how did you approach it?

scofalik avatar Jun 12 '24 09:06 scofalik

Sure - this block of code from the handleNewCommentThread function:

    // When an annotation is created or reopened we need to bound its focus manager with the field.
    // Thanks to that, the annotation will be focused whenever the field is focused as well.
    // However, this can be done only for one annotation, so we do it only if there are no open
    // annotations for given field.
    if ( !openThreads.length ) {
        const threadView = commentsRepository._threadToController.get( thread ).view;
        const annotation = annotations.collection.getByInnerView( threadView );

        annotation.focusableElements.add( field );
    }

I would prefer to not write code that is peering into internal properties in order to make this scenario perform well. If the above code is required by all integrations that use comments outside of the editor, then there should be supported API methods to implement the above.

ryanj-openquire avatar Jun 12 '24 13:06 ryanj-openquire

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

CKEditorBot avatar Jun 12 '25 23:06 CKEditorBot

We've closed your issue due to inactivity. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).

CKEditorBot avatar Jul 13 '25 23:07 CKEditorBot