diff --git a/dist/bundle.js b/dist/bundle.js index bde1069c8..6bbf473c5 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -82900,29 +82900,29 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { BI.RichEditorParamAction.superclass._init.apply(this, arguments); }, - _createBlankNode: function () { - return $("").html(" "); - }, - - _addBlank: function ($param) { - var o = this.options; - var instance = o.editor.selectedInstance; - var next = $param.next(); - if (next.length === 0) { - var nextNode = this._createBlankNode(); - $param.after(nextNode); - instance.setFocus(nextNode[0]); - } else { - instance.setFocus(next[0]); - } - }, - - _get$Sel: function () { - var o = this.options; - var instance = o.editor.selectedInstance; - var sel = $(instance.selElm()); - return sel; - }, + // _createBlankNode: function () { + // return $("").html(" "); + // }, + + // _addBlank: function ($param) { + // var o = this.options; + // var instance = o.editor.selectedInstance; + // var next = $param.next(); + // if (next.length === 0) { + // var nextNode = this._createBlankNode(); + // $param.after(nextNode); + // instance.setFocus(nextNode[0]); + // } else { + // instance.setFocus(next[0]); + // } + // }, + // + // _get$Sel: function () { + // var o = this.options; + // var instance = o.editor.selectedInstance; + // var sel = $(instance.selElm()); + // return sel; + // }, addParam: function (param) { var o = this.options; @@ -82933,14 +82933,15 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { image.alt = param; image.style = attrs.style; $(image).addClass("rich-editor-param"); - var sel = this._get$Sel(); - var wrapper = o.editor.instance.getElm().element; - if (wrapper.find(sel).length <= 0) { - wrapper.append(image); - } else { - sel.after(image); - } - this._addBlank($(image)); + this.options.editor.insertHTML($("
").append(image).html()); + // var sel = this._get$Sel(); + // var wrapper = o.editor.instance.getElm().element; + // if (wrapper.find(sel).length <= 0) { + // wrapper.append(image); + // } else { + // sel.after(image); + // } + // this._addBlank($(image)); } }); @@ -83153,12 +83154,24 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** } else { console.error("不支持此浏览器"); } - if(o.readOnly) { + if (o.readOnly) { newInstance.disable(); } return newInstance; }, + insertElem: function ($elem) { + if (this.selectedInstance) { + this.selectedInstance.insertElem($elem); + } + }, + + insertHTML: function (html) { + if (this.selectedInstance) { + this.selectedInstance.insertHTML(html); + } + }, + nicCommand: function (cmd, args) { if (this.selectedInstance) { this.selectedInstance.nicCommand(cmd, args); @@ -83300,7 +83313,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** return contain; } return (this.getSel().type == "Control") ? r.item(0) : r.parentElement(); - + }, saveRng: function () { @@ -83401,6 +83414,31 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** this.elm.element.html(this.content); }, + insertElem: function ($elem) { + var range = this.getRng(); + + if (range.insertNode) { + range.deleteContents(); + range.insertNode($elem); + } + }, + + insertHTML: function (html) { + var range = this.getRng(); + + if (document.queryCommandState("insertHTML")) { + // W3C + this.nicCommand("insertHTML", html); + } else if (range.insertNode) { + // IE + range.deleteContents(); + range.insertNode($(html)[0]); + } else if (range.pasteHTML) { + // IE <= 10 + range.pasteHTML(html); + } + }, + nicCommand: function (cmd, args) { document.execCommand(cmd, false, args); } diff --git a/dist/case.js b/dist/case.js index 8bec6edba..1a7ca1b1f 100644 --- a/dist/case.js +++ b/dist/case.js @@ -10427,29 +10427,29 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { BI.RichEditorParamAction.superclass._init.apply(this, arguments); }, - _createBlankNode: function () { - return $("").html(" "); - }, - - _addBlank: function ($param) { - var o = this.options; - var instance = o.editor.selectedInstance; - var next = $param.next(); - if (next.length === 0) { - var nextNode = this._createBlankNode(); - $param.after(nextNode); - instance.setFocus(nextNode[0]); - } else { - instance.setFocus(next[0]); - } - }, - - _get$Sel: function () { - var o = this.options; - var instance = o.editor.selectedInstance; - var sel = $(instance.selElm()); - return sel; - }, + // _createBlankNode: function () { + // return $("").html(" "); + // }, + + // _addBlank: function ($param) { + // var o = this.options; + // var instance = o.editor.selectedInstance; + // var next = $param.next(); + // if (next.length === 0) { + // var nextNode = this._createBlankNode(); + // $param.after(nextNode); + // instance.setFocus(nextNode[0]); + // } else { + // instance.setFocus(next[0]); + // } + // }, + // + // _get$Sel: function () { + // var o = this.options; + // var instance = o.editor.selectedInstance; + // var sel = $(instance.selElm()); + // return sel; + // }, addParam: function (param) { var o = this.options; @@ -10460,14 +10460,15 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { image.alt = param; image.style = attrs.style; $(image).addClass("rich-editor-param"); - var sel = this._get$Sel(); - var wrapper = o.editor.instance.getElm().element; - if (wrapper.find(sel).length <= 0) { - wrapper.append(image); - } else { - sel.after(image); - } - this._addBlank($(image)); + this.options.editor.insertHTML($("
").append(image).html()); + // var sel = this._get$Sel(); + // var wrapper = o.editor.instance.getElm().element; + // if (wrapper.find(sel).length <= 0) { + // wrapper.append(image); + // } else { + // sel.after(image); + // } + // this._addBlank($(image)); } }); @@ -10680,12 +10681,24 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** } else { console.error("不支持此浏览器"); } - if(o.readOnly) { + if (o.readOnly) { newInstance.disable(); } return newInstance; }, + insertElem: function ($elem) { + if (this.selectedInstance) { + this.selectedInstance.insertElem($elem); + } + }, + + insertHTML: function (html) { + if (this.selectedInstance) { + this.selectedInstance.insertHTML(html); + } + }, + nicCommand: function (cmd, args) { if (this.selectedInstance) { this.selectedInstance.nicCommand(cmd, args); @@ -10827,7 +10840,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** return contain; } return (this.getSel().type == "Control") ? r.item(0) : r.parentElement(); - + }, saveRng: function () { @@ -10928,6 +10941,31 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** this.elm.element.html(this.content); }, + insertElem: function ($elem) { + var range = this.getRng(); + + if (range.insertNode) { + range.deleteContents(); + range.insertNode($elem); + } + }, + + insertHTML: function (html) { + var range = this.getRng(); + + if (document.queryCommandState("insertHTML")) { + // W3C + this.nicCommand("insertHTML", html); + } else if (range.insertNode) { + // IE + range.deleteContents(); + range.insertNode($(html)[0]); + } else if (range.pasteHTML) { + // IE <= 10 + range.pasteHTML(html); + } + }, + nicCommand: function (cmd, args) { document.execCommand(cmd, false, args); } diff --git a/dist/fineui.js b/dist/fineui.js index 1006e4d8b..5fe13f367 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -83143,29 +83143,29 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { BI.RichEditorParamAction.superclass._init.apply(this, arguments); }, - _createBlankNode: function () { - return $("").html(" "); - }, - - _addBlank: function ($param) { - var o = this.options; - var instance = o.editor.selectedInstance; - var next = $param.next(); - if (next.length === 0) { - var nextNode = this._createBlankNode(); - $param.after(nextNode); - instance.setFocus(nextNode[0]); - } else { - instance.setFocus(next[0]); - } - }, - - _get$Sel: function () { - var o = this.options; - var instance = o.editor.selectedInstance; - var sel = $(instance.selElm()); - return sel; - }, + // _createBlankNode: function () { + // return $("").html(" "); + // }, + + // _addBlank: function ($param) { + // var o = this.options; + // var instance = o.editor.selectedInstance; + // var next = $param.next(); + // if (next.length === 0) { + // var nextNode = this._createBlankNode(); + // $param.after(nextNode); + // instance.setFocus(nextNode[0]); + // } else { + // instance.setFocus(next[0]); + // } + // }, + // + // _get$Sel: function () { + // var o = this.options; + // var instance = o.editor.selectedInstance; + // var sel = $(instance.selElm()); + // return sel; + // }, addParam: function (param) { var o = this.options; @@ -83176,14 +83176,15 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { image.alt = param; image.style = attrs.style; $(image).addClass("rich-editor-param"); - var sel = this._get$Sel(); - var wrapper = o.editor.instance.getElm().element; - if (wrapper.find(sel).length <= 0) { - wrapper.append(image); - } else { - sel.after(image); - } - this._addBlank($(image)); + this.options.editor.insertHTML($("
").append(image).html()); + // var sel = this._get$Sel(); + // var wrapper = o.editor.instance.getElm().element; + // if (wrapper.find(sel).length <= 0) { + // wrapper.append(image); + // } else { + // sel.after(image); + // } + // this._addBlank($(image)); } }); @@ -83396,12 +83397,24 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** } else { console.error("不支持此浏览器"); } - if(o.readOnly) { + if (o.readOnly) { newInstance.disable(); } return newInstance; }, + insertElem: function ($elem) { + if (this.selectedInstance) { + this.selectedInstance.insertElem($elem); + } + }, + + insertHTML: function (html) { + if (this.selectedInstance) { + this.selectedInstance.insertHTML(html); + } + }, + nicCommand: function (cmd, args) { if (this.selectedInstance) { this.selectedInstance.nicCommand(cmd, args); @@ -83543,7 +83556,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** return contain; } return (this.getSel().type == "Control") ? r.item(0) : r.parentElement(); - + }, saveRng: function () { @@ -83644,6 +83657,31 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** this.elm.element.html(this.content); }, + insertElem: function ($elem) { + var range = this.getRng(); + + if (range.insertNode) { + range.deleteContents(); + range.insertNode($elem); + } + }, + + insertHTML: function (html) { + var range = this.getRng(); + + if (document.queryCommandState("insertHTML")) { + // W3C + this.nicCommand("insertHTML", html); + } else if (range.insertNode) { + // IE + range.deleteContents(); + range.insertNode($(html)[0]); + } else if (range.pasteHTML) { + // IE <= 10 + range.pasteHTML(html); + } + }, + nicCommand: function (cmd, args) { document.execCommand(cmd, false, args); } diff --git a/dist/font/iconfont.eot b/dist/font/iconfont.eot index cb5bd0073..1a77f40de 100644 Binary files a/dist/font/iconfont.eot and b/dist/font/iconfont.eot differ diff --git a/dist/font/iconfont.svg b/dist/font/iconfont.svg index eb781aab5..a64f28a1b 100644 --- a/dist/font/iconfont.svg +++ b/dist/font/iconfont.svg @@ -993,6 +993,75 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dist/font/iconfont.ttf b/dist/font/iconfont.ttf index c6a8b5e2b..e2ac6a209 100644 Binary files a/dist/font/iconfont.ttf and b/dist/font/iconfont.ttf differ diff --git a/dist/font/iconfont.woff b/dist/font/iconfont.woff index 772ffdf5f..f8b1c00ea 100644 Binary files a/dist/font/iconfont.woff and b/dist/font/iconfont.woff differ diff --git a/src/case/richeditor/bar/action.richeditor.param.js b/src/case/richeditor/bar/action.richeditor.param.js index 3bbfea611..76a267d83 100644 --- a/src/case/richeditor/bar/action.richeditor.param.js +++ b/src/case/richeditor/bar/action.richeditor.param.js @@ -17,29 +17,29 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { BI.RichEditorParamAction.superclass._init.apply(this, arguments); }, - _createBlankNode: function () { - return $("").html(" "); - }, - - _addBlank: function ($param) { - var o = this.options; - var instance = o.editor.selectedInstance; - var next = $param.next(); - if (next.length === 0) { - var nextNode = this._createBlankNode(); - $param.after(nextNode); - instance.setFocus(nextNode[0]); - } else { - instance.setFocus(next[0]); - } - }, + // _createBlankNode: function () { + // return $("").html(" "); + // }, - _get$Sel: function () { - var o = this.options; - var instance = o.editor.selectedInstance; - var sel = $(instance.selElm()); - return sel; - }, + // _addBlank: function ($param) { + // var o = this.options; + // var instance = o.editor.selectedInstance; + // var next = $param.next(); + // if (next.length === 0) { + // var nextNode = this._createBlankNode(); + // $param.after(nextNode); + // instance.setFocus(nextNode[0]); + // } else { + // instance.setFocus(next[0]); + // } + // }, + // + // _get$Sel: function () { + // var o = this.options; + // var instance = o.editor.selectedInstance; + // var sel = $(instance.selElm()); + // return sel; + // }, addParam: function (param) { var o = this.options; @@ -50,14 +50,15 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { image.alt = param; image.style = attrs.style; $(image).addClass("rich-editor-param"); - var sel = this._get$Sel(); - var wrapper = o.editor.instance.getElm().element; - if (wrapper.find(sel).length <= 0) { - wrapper.append(image); - } else { - sel.after(image); - } - this._addBlank($(image)); + this.options.editor.insertHTML($("
").append(image).html()); + // var sel = this._get$Sel(); + // var wrapper = o.editor.instance.getElm().element; + // if (wrapper.find(sel).length <= 0) { + // wrapper.append(image); + // } else { + // sel.after(image); + // } + // this._addBlank($(image)); } }); diff --git a/src/case/richeditor/niceditor/niceditor.js b/src/case/richeditor/niceditor/niceditor.js index 8bccc88da..86593599d 100644 --- a/src/case/richeditor/niceditor/niceditor.js +++ b/src/case/richeditor/niceditor/niceditor.js @@ -35,12 +35,24 @@ } else { console.error("不支持此浏览器"); } - if(o.readOnly) { + if (o.readOnly) { newInstance.disable(); } return newInstance; }, + insertElem: function ($elem) { + if (this.selectedInstance) { + this.selectedInstance.insertElem($elem); + } + }, + + insertHTML: function (html) { + if (this.selectedInstance) { + this.selectedInstance.insertHTML(html); + } + }, + nicCommand: function (cmd, args) { if (this.selectedInstance) { this.selectedInstance.nicCommand(cmd, args); @@ -182,7 +194,7 @@ return contain; } return (this.getSel().type == "Control") ? r.item(0) : r.parentElement(); - + }, saveRng: function () { @@ -283,6 +295,31 @@ this.elm.element.html(this.content); }, + insertElem: function ($elem) { + var range = this.getRng(); + + if (range.insertNode) { + range.deleteContents(); + range.insertNode($elem); + } + }, + + insertHTML: function (html) { + var range = this.getRng(); + + if (document.queryCommandState("insertHTML")) { + // W3C + this.nicCommand("insertHTML", html); + } else if (range.insertNode) { + // IE + range.deleteContents(); + range.insertNode($(html)[0]); + } else if (range.pasteHTML) { + // IE <= 10 + range.pasteHTML(html); + } + }, + nicCommand: function (cmd, args) { document.execCommand(cmd, false, args); }