CKEditor: Modifying view without changing data -


i have content references images id within placeholder (e.g. "$m(12345)" ). have rest call return img-tag placeholder.

i ckeditor display image when content opened in editor, or placeholder inserted. want placeholder remain in content (including when switching source view)

i've tried adding rule datafilter:

ckeditor.on('instanceloaded', function(ckeditor){      var mediaplaceholderregex = /\$m\(.*\)/;      ckeditor.editor.dataprocessor.datafilter.addrules({          text: function( text, node ) {                 return text.replace( mediaplaceholderregex, function( match ) {                      var params = "placeholder="+match;                     var xhttp = new xmlhttprequest();                     xhttp.open("post", url, false);                     xhttp.setrequestheader("content-type", "application/x-www-form-urlencoded");                     xhttp.send(params);                     return xhttp.responsetext;                 } );             }      });  }); 

it job of replacing placeholder image tag, img-tag there when switching source view.

is there easy way apply filter wysiwyg view. way see add htmlfilter revert img-tag placeholder.

is there easy way apply filter wysiwyg view. way see add htmlfilter revert img-tag placeholder.

good thinking. either of if don't want images removed/fetched server on every mode change, can example put placeholder data- attribute image tag. depends on use case bottom line datafilter used when load data editor , htmlfilter when data editor (same methods used when getting data , switching source mode htmlfilter applies here).


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -