Ver código fonte

[editor] more fixes webnotes/erpnext#1011

version-14
Rushabh Mehta 11 anos atrás
pai
commit
dc00dc0445
1 arquivos alterados com 5 adições e 5 exclusões
  1. +5
    -5
      public/js/wn/ui/editor.js

+ 5
- 5
public/js/wn/ui/editor.js Ver arquivo

@@ -446,7 +446,7 @@ bsHTMLEditor = Class.extend({
this.modal.addClass("wn-ignore-click"); this.modal.addClass("wn-ignore-click");
this.modal.find(".btn-primary").on("click", function() { this.modal.find(".btn-primary").on("click", function() {
var html = me.modal.find("textarea").val(); var html = me.modal.find("textarea").val();
$.each(me.dataurls, function(key, val) {
$.each(me.editor.dataurls, function(key, val) {
html = html.replace(key, val); html = html.replace(key, val);
}) })
me.editor.html(html); me.editor.html(html);
@@ -459,13 +459,13 @@ bsHTMLEditor = Class.extend({
this.modal.modal("show") this.modal.modal("show")
var html = me.editor.html(); var html = me.editor.html();
// pack dataurls so that html display is faster // pack dataurls so that html display is faster
this.dataurls = {}
this.editor.dataurls = {}
html = html.replace(/<img\s*src=\s*["\'](data:[^,]*),([^"\']*)["\']/g, function(full, g1, g2) { html = html.replace(/<img\s*src=\s*["\'](data:[^,]*),([^"\']*)["\']/g, function(full, g1, g2) {
var key = g2.slice(0,5) + "..." + g2.slice(-5); var key = g2.slice(0,5) + "..." + g2.slice(-5);
me.dataurls[key] = g1 + "," + g2;
me.editor.dataurls[key] = g1 + "," + g2;
return '<img src="'+g1 + "," + key+'"'; return '<img src="'+g1 + "," + key+'"';
})
this.modal.find("textarea").html(html_beautify(html));
});
this.modal.find("textarea").val(html_beautify(html));
} }
}); });




Carregando…
Cancelar
Salvar