Using inline CKEditor on dynamically added text -
i building web app uses javascript dynamically add elements page, can edited using contenteditable="true"
, ckeditor
.
currently if add element page contenteditable="true"
, element editable ckeditor
toolbar not appearing.
i have tried calling ckeditor.inlineall()
doesn't seem anything.
how can activate ckeditor
inline editing on dynamically created elements? (without refreshing page).
edit: have found giving element id of (e.g.) someid , calling ckeditor.inline(someid) has desired effect. don't want have add unique ids of elements. there way activate ckeditor on contenteditable elements?
ckeditor.inline
accepts native dom element parameter. no matter how create dynamic elements, if pass reference function, convert ckeditor instance. example, assuming use jquery main framework:
// dynamically created element. var el = $( '<p contenteditable="true">i\'m editable!</p>' ); // append element <body>. $( 'body' ).append( el ); // ckeditor.inline accepts dom element parameter. ckeditor.inline( el.get( 0 ) );
see the fiddle.
Comments
Post a Comment