You can apply one of the two best answers to your JavaScript question : how to cut HTML tags from a string? after .code() to remove tags.
ReactiveRaven's answer (to keep it on one line) works fine for me:
cleanText = $("#summernote").code().replace(/<\/?[^>]+(>|$)/g, "");
For example, With [{"_type":"ServerOperation","operationType":"ANNOUNCE"}] :
And if you want to keep the carriage return, you can replace </p> and <br> with \n before applying the solution indicated in the related question:
$("#summernote").code() .replace(/<\/p>/gi, "\n") .replace(/<br\/?>/gi, "\n") .replace(/<\/?[^>]+(>|$)/g, "");
source share