Giter Site home page Giter Site logo

Comments (7)

pety-dc avatar pety-dc commented on September 22, 2024 1

The following snippet can be used as a temporary remedy:

editor.on('component:update', (component) => {
            if (component.isInstanceOf('text')){                
                if (component && component.view && component.view.activeRte && component.view.activeRte.container && component.view.activeRte.container && component.view.activeRte.container.isDetached()){                    
                    component.view.activeRte.destroy();                    
                }
            }
});

from ckeditor.

michael-koeppe avatar michael-koeppe commented on September 22, 2024 1

Hey @pety-dc ,
I ran into the same issue. I tryed your solution but it threw an error, telling me, that isDetached is not a function.
The following code does the job in my case:

editor.on('component:update', (component) => {
    if (component && component.isInstanceOf('text') && component.view && component.view.activeRte && component.view.activeRte.container && component.view.activeRte.container.isDetached()) {
        component.view.activeRte.destroy();
    }
});

Update: The isDetached() function is indispensable if you want to enter more text after making changes to the styles. An update to CKE v. 4.21 is strongly recommended. I had only taken care of the styles and did not notice that the CK is also destroyed when the component updates itself by text input.

from ckeditor.

pety-dc avatar pety-dc commented on September 22, 2024

Hey @michael-koeppe,

I don't know what version of CKEditor do you use.
The isDetached method was added in 4.13
https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html#method-isDetached

However, I didn't find it in CKEditor 5.

from ckeditor.

plomi-net avatar plomi-net commented on September 22, 2024

Hi @pety-dc,
i'm interested for a solution with this problem too.
I can reproduce the same issue with the release package from this grapesjs repository.

https://github.com/GrapesJS/grapesjs/tree/gh-pages

The version in the repository should be 4.6.2.
Would be this a solution to change the ckeditor version to the latest 4.21.0 ?

Many thanks in advance!

from ckeditor.

pety-dc avatar pety-dc commented on September 22, 2024

@plomi-net
TBH, I'm not sure what you wanted to ask. I'm trying to figure out.

AFAIK the issue that the GrapesJS canvas loses contact with the CKEditor instance when attributes of a text is edited on GrapesJS toolbar (which causes the text component to be redrawn on the canvas) is not dependent of CKeditor version.
Merely upgrading the CKEditor version does not fix this issue.

Having CKEditor version >=4.13 is only required for my suggested solution to this problem which uses the isDetached method which was introduced in CKE in v4.13.

from ckeditor.

plomi-net avatar plomi-net commented on September 22, 2024

@pety-dc
Your suggested solution working fine.
i have updated the ckeditor version to use the ìsDetached` method.
I just say that the repository still contains an outdated version of ckeditor :)

from ckeditor.

yongma16 avatar yongma16 commented on September 22, 2024

editor.on('component:update', (component) => {
if (component && component.isInstanceOf('text') && component.view && component.view.activeRte && component.view.activeRte.container && component.view.activeRte.container.isDetached()) {
component.view.activeRte.destroy();
}
});

nice

from ckeditor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.