@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.9 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/LcdpUeditor.d.ts +1 -0
- package/es/LcdpUeditor.d.ts.map +1 -0
- package/es/LcdpUeditor.js +72 -61
- package/es/const.d.ts.map +1 -0
- package/es/const.js +4 -4
- package/es/defaultConfig.json +76 -76
- package/es/index.d.ts.map +1 -0
- package/es/tools/UeditorResourceLoader.d.ts.map +1 -0
- package/es/tools/UeditorResourceLoader.js +11 -16
- package/es/tools/filterHtmlNode.d.ts +5 -0
- package/es/tools/filterHtmlNode.d.ts.map +1 -0
- package/es/tools/filterHtmlNode.js +41 -0
- package/es/tools/loadScript.d.ts.map +1 -0
- package/es/tools/loadScript.js +5 -7
- package/es/type.d.ts +6 -0
- package/es/type.d.ts.map +1 -0
- package/lib/LcdpUeditor.d.ts +1 -0
- package/lib/LcdpUeditor.js +24 -8
- package/lib/defaultConfig.json +76 -76
- package/lib/tools/filterHtmlNode.d.ts +5 -0
- package/lib/tools/filterHtmlNode.js +61 -0
- package/lib/type.d.ts +6 -0
- package/package.json +35 -34
- package/ueditor-resource/dialogs/anchor/anchor.html +62 -62
- package/ueditor-resource/dialogs/attachment/attachment.css +716 -716
- package/ueditor-resource/dialogs/attachment/attachment.html +61 -61
- package/ueditor-resource/dialogs/attachment/attachment.js +803 -803
- package/ueditor-resource/dialogs/audio/audio.css +879 -879
- package/ueditor-resource/dialogs/audio/audio.html +93 -93
- package/ueditor-resource/dialogs/audio/audio.js +815 -815
- package/ueditor-resource/dialogs/background/background.css +193 -193
- package/ueditor-resource/dialogs/background/background.html +59 -59
- package/ueditor-resource/dialogs/background/background.js +370 -370
- package/ueditor-resource/dialogs/contentimport/contentimport.html +176 -176
- package/ueditor-resource/dialogs/contentimport/contentimport.js +91 -91
- package/ueditor-resource/dialogs/emotion/emotion.css +129 -129
- package/ueditor-resource/dialogs/emotion/emotion.html +70 -70
- package/ueditor-resource/dialogs/emotion/emotion.js +186 -186
- package/ueditor-resource/dialogs/formula/formula.html +98 -98
- package/ueditor-resource/dialogs/formula/formula.js +147 -147
- package/ueditor-resource/dialogs/help/help.css +37 -37
- package/ueditor-resource/dialogs/help/help.html +82 -82
- package/ueditor-resource/dialogs/help/help.js +57 -57
- package/ueditor-resource/dialogs/image/image.css +768 -768
- package/ueditor-resource/dialogs/image/image.html +144 -144
- package/ueditor-resource/dialogs/image/image.js +1060 -1060
- package/ueditor-resource/dialogs/insertframe/insertframe.html +135 -135
- package/ueditor-resource/dialogs/internal.js +81 -81
- package/ueditor-resource/dialogs/link/link.html +148 -148
- package/ueditor-resource/dialogs/preview/preview.html +45 -45
- package/ueditor-resource/dialogs/scrawl/scrawl.css +324 -324
- package/ueditor-resource/dialogs/scrawl/scrawl.html +95 -95
- package/ueditor-resource/dialogs/scrawl/scrawl.js +682 -682
- package/ueditor-resource/dialogs/searchreplace/searchreplace.html +144 -144
- package/ueditor-resource/dialogs/searchreplace/searchreplace.js +174 -174
- package/ueditor-resource/dialogs/spechars/spechars.html +42 -42
- package/ueditor-resource/dialogs/spechars/spechars.js +86 -86
- package/ueditor-resource/dialogs/table/edittable.css +85 -85
- package/ueditor-resource/dialogs/table/edittable.html +69 -69
- package/ueditor-resource/dialogs/table/edittable.js +241 -241
- package/ueditor-resource/dialogs/table/edittd.html +62 -62
- package/ueditor-resource/dialogs/table/edittip.html +33 -33
- package/ueditor-resource/dialogs/template/config.js +42 -42
- package/ueditor-resource/dialogs/template/template.css +99 -99
- package/ueditor-resource/dialogs/template/template.html +26 -26
- package/ueditor-resource/dialogs/template/template.js +53 -53
- package/ueditor-resource/dialogs/video/video.css +909 -909
- package/ueditor-resource/dialogs/video/video.html +114 -114
- package/ueditor-resource/dialogs/video/video.js +867 -867
- package/ueditor-resource/dialogs/wordimage/wordimage.html +221 -221
- package/ueditor-resource/dialogs/wordimage/wordimage.js +93 -93
- package/ueditor-resource/lang/en/en.js +686 -686
- package/ueditor-resource/lang/zh-cn/zh-cn.js +748 -748
- package/ueditor-resource/lang/zh-tw/zh-tw.js +748 -748
- package/ueditor-resource/plugins/demo/demo.js +3 -3
- package/ueditor-resource/themes/default/css/ueditor.css +2149 -2148
- package/ueditor-resource/themes/default/dialog.css +17 -17
- package/ueditor-resource/themes/default/dialogbase.css +132 -132
- package/ueditor-resource/themes/default/exts/ai.svg +12 -12
- package/ueditor-resource/themes/default/exts/apk.svg +12 -12
- package/ueditor-resource/themes/default/exts/chm.svg +12 -12
- package/ueditor-resource/themes/default/exts/css.svg +12 -12
- package/ueditor-resource/themes/default/exts/doc.svg +22 -22
- package/ueditor-resource/themes/default/exts/docx.svg +22 -22
- package/ueditor-resource/themes/default/exts/dwg.svg +16 -16
- package/ueditor-resource/themes/default/exts/folder.svg +3 -3
- package/ueditor-resource/themes/default/exts/gif.svg +14 -14
- package/ueditor-resource/themes/default/exts/html.svg +12 -12
- package/ueditor-resource/themes/default/exts/jpeg.svg +14 -14
- package/ueditor-resource/themes/default/exts/jpg.svg +14 -14
- package/ueditor-resource/themes/default/exts/log.svg +12 -12
- package/ueditor-resource/themes/default/exts/mp3.svg +14 -14
- package/ueditor-resource/themes/default/exts/mp4.svg +12 -12
- package/ueditor-resource/themes/default/exts/pdf.svg +14 -14
- package/ueditor-resource/themes/default/exts/png.svg +14 -14
- package/ueditor-resource/themes/default/exts/ppt.svg +24 -24
- package/ueditor-resource/themes/default/exts/pptx.svg +24 -24
- package/ueditor-resource/themes/default/exts/psd.svg +12 -12
- package/ueditor-resource/themes/default/exts/rar.svg +12 -12
- package/ueditor-resource/themes/default/exts/svg.svg +12 -12
- package/ueditor-resource/themes/default/exts/torrent.svg +14 -14
- package/ueditor-resource/themes/default/exts/txt.svg +14 -14
- package/ueditor-resource/themes/default/exts/unknown.svg +12 -12
- package/ueditor-resource/themes/default/exts/xls.svg +25 -25
- package/ueditor-resource/themes/default/exts/xlsx.svg +25 -25
- package/ueditor-resource/themes/default/exts/zip.svg +12 -12
- package/ueditor-resource/themes/iframe.css +63 -63
- package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3655 -3655
- package/ueditor-resource/third-party/clipboard/clipboard.js +752 -752
- package/ueditor-resource/third-party/codemirror/codemirror.css +106 -106
- package/ueditor-resource/third-party/codemirror/codemirror.js +3581 -3581
- package/ueditor-resource/third-party/jquery-3.5.1.js +1 -1
- package/ueditor-resource/third-party/jquery-3.5.1_1.js +4314 -4314
- package/ueditor-resource/third-party/webuploader/webuploader.css +88 -88
- package/ueditor-resource/third-party/webuploader/webuploader.js +3 -3
- package/ueditor-resource/third-party/zeroclipboard/ZeroClipboard.js +1255 -1255
- package/ueditor-resource/{lcdp-ueditor.all.js → ueditor.all.js} +5270 -5269
- package/ueditor-resource/ueditor.config.js +655 -655
- package/ueditor-resource/{lcdp-ueditor.parse.js → ueditor.parse.js} +13 -13
- package/ueditor-resource/index.html +0 -146
| @@ -1,241 +1,241 @@ | |
| 1 | 
            -
            /**
         | 
| 2 | 
            -
             * Created with JetBrains PhpStorm.
         | 
| 3 | 
            -
             * User: xuheng
         | 
| 4 | 
            -
             * Date: 12-12-19
         | 
| 5 | 
            -
             * Time: 下午4:55
         | 
| 6 | 
            -
             * To change this template use File | Settings | File Templates.
         | 
| 7 | 
            -
             */
         | 
| 8 | 
            -
            (function () {
         | 
| 9 | 
            -
                var title = $G("J_title"),
         | 
| 10 | 
            -
                    titleCol = $G("J_titleCol"),
         | 
| 11 | 
            -
                    caption = $G("J_caption"),
         | 
| 12 | 
            -
                    sorttable = $G("J_sorttable"),
         | 
| 13 | 
            -
                    autoSizeContent = $G("J_autoSizeContent"),
         | 
| 14 | 
            -
                    autoSizePage = $G("J_autoSizePage"),
         | 
| 15 | 
            -
                    tone = $G("J_tone"),
         | 
| 16 | 
            -
                    me,
         | 
| 17 | 
            -
                    preview = $G("J_preview");
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                var editTable = function () {
         | 
| 20 | 
            -
                    me = this;
         | 
| 21 | 
            -
                    me.init();
         | 
| 22 | 
            -
                };
         | 
| 23 | 
            -
                editTable.prototype = {
         | 
| 24 | 
            -
                    init: function () {
         | 
| 25 | 
            -
                        var colorPiker = new UE.ui.ColorPicker({
         | 
| 26 | 
            -
                                editor: editor
         | 
| 27 | 
            -
                            }),
         | 
| 28 | 
            -
                            colorPop = new UE.ui.Popup({
         | 
| 29 | 
            -
                                editor: editor,
         | 
| 30 | 
            -
                                content: colorPiker
         | 
| 31 | 
            -
                            });
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                        title.checked = editor.queryCommandState("inserttitle") == -1;
         | 
| 34 | 
            -
                        titleCol.checked = editor.queryCommandState("inserttitlecol") == -1;
         | 
| 35 | 
            -
                        caption.checked = editor.queryCommandState("insertcaption") == -1;
         | 
| 36 | 
            -
                        sorttable.checked = editor.queryCommandState("enablesort") == 1;
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                        var enablesortState = editor.queryCommandState("enablesort"),
         | 
| 39 | 
            -
                            disablesortState = editor.queryCommandState("disablesort");
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                        sorttable.checked = !!(enablesortState < 0 && disablesortState >= 0);
         | 
| 42 | 
            -
                        sorttable.disabled = !!(enablesortState < 0 && disablesortState < 0);
         | 
| 43 | 
            -
                        sorttable.title = enablesortState < 0 && disablesortState < 0 ? lang.errorMsg : '';
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                        me.createTable(title.checked, titleCol.checked, caption.checked);
         | 
| 46 | 
            -
                        me.setAutoSize();
         | 
| 47 | 
            -
                        me.setColor(me.getColor());
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                        domUtils.on(title, "click", me.titleHanler);
         | 
| 50 | 
            -
                        domUtils.on(titleCol, "click", me.titleColHanler);
         | 
| 51 | 
            -
                        domUtils.on(caption, "click", me.captionHanler);
         | 
| 52 | 
            -
                        domUtils.on(sorttable, "click", me.sorttableHanler);
         | 
| 53 | 
            -
                        domUtils.on(autoSizeContent, "click", me.autoSizeContentHanler);
         | 
| 54 | 
            -
                        domUtils.on(autoSizePage, "click", me.autoSizePageHanler);
         | 
| 55 | 
            -
             | 
| 56 | 
            -
                        domUtils.on(tone, "click", function () {
         | 
| 57 | 
            -
                            colorPop.showAnchor(tone);
         | 
| 58 | 
            -
                        });
         | 
| 59 | 
            -
                        domUtils.on(document, 'mousedown', function () {
         | 
| 60 | 
            -
                            colorPop.hide();
         | 
| 61 | 
            -
                        });
         | 
| 62 | 
            -
                        colorPiker.addListener("pickcolor", function () {
         | 
| 63 | 
            -
                            me.setColor(arguments[1]);
         | 
| 64 | 
            -
                            colorPop.hide();
         | 
| 65 | 
            -
                        });
         | 
| 66 | 
            -
                        colorPiker.addListener("picknocolor", function () {
         | 
| 67 | 
            -
                            me.setColor("");
         | 
| 68 | 
            -
                            colorPop.hide();
         | 
| 69 | 
            -
                        });
         | 
| 70 | 
            -
                    },
         | 
| 71 | 
            -
             | 
| 72 | 
            -
                    createTable: function (hasTitle, hasTitleCol, hasCaption) {
         | 
| 73 | 
            -
                        var arr = [],
         | 
| 74 | 
            -
                            sortSpan = '<span>^</span>';
         | 
| 75 | 
            -
                        arr.push("<table id='J_example'>");
         | 
| 76 | 
            -
                        if (hasCaption) {
         | 
| 77 | 
            -
                            arr.push("<caption>" + lang.captionName + "</caption>")
         | 
| 78 | 
            -
                        }
         | 
| 79 | 
            -
                        if (hasTitle) {
         | 
| 80 | 
            -
                            arr.push("<tr>");
         | 
| 81 | 
            -
                            if (hasTitleCol) {
         | 
| 82 | 
            -
                                arr.push("<th>" + lang.titleName + "</th>");
         | 
| 83 | 
            -
                            }
         | 
| 84 | 
            -
                            for (var j = 0; j < 5; j++) {
         | 
| 85 | 
            -
                                arr.push("<th>" + lang.titleName + "</th>");
         | 
| 86 | 
            -
                            }
         | 
| 87 | 
            -
                            arr.push("</tr>");
         | 
| 88 | 
            -
                        }
         | 
| 89 | 
            -
                        for (var i = 0; i < 6; i++) {
         | 
| 90 | 
            -
                            arr.push("<tr>");
         | 
| 91 | 
            -
                            if (hasTitleCol) {
         | 
| 92 | 
            -
                                arr.push("<th>" + lang.titleName + "</th>")
         | 
| 93 | 
            -
                            }
         | 
| 94 | 
            -
                            for (var k = 0; k < 5; k++) {
         | 
| 95 | 
            -
                                arr.push("<td>" + lang.cellsName + "</td>")
         | 
| 96 | 
            -
                            }
         | 
| 97 | 
            -
                            arr.push("</tr>");
         | 
| 98 | 
            -
                        }
         | 
| 99 | 
            -
                        arr.push("</table>");
         | 
| 100 | 
            -
                        preview.innerHTML = arr.join("");
         | 
| 101 | 
            -
                        this.updateSortSpan();
         | 
| 102 | 
            -
                    },
         | 
| 103 | 
            -
                    titleHanler: function () {
         | 
| 104 | 
            -
                        var example = $G("J_example"),
         | 
| 105 | 
            -
                            frg = document.createDocumentFragment(),
         | 
| 106 | 
            -
                            color = domUtils.getComputedStyle(domUtils.getElementsByTagName(example, "td")[0], "border-color"),
         | 
| 107 | 
            -
                            colCount = example.rows[0].children.length;
         | 
| 108 | 
            -
             | 
| 109 | 
            -
                        if (title.checked) {
         | 
| 110 | 
            -
                            example.insertRow(0);
         | 
| 111 | 
            -
                            for (var i = 0, node; i < colCount; i++) {
         | 
| 112 | 
            -
                                node = document.createElement("th");
         | 
| 113 | 
            -
                                node.innerHTML = lang.titleName;
         | 
| 114 | 
            -
                                frg.appendChild(node);
         | 
| 115 | 
            -
                            }
         | 
| 116 | 
            -
                            example.rows[0].appendChild(frg);
         | 
| 117 | 
            -
             | 
| 118 | 
            -
                        } else {
         | 
| 119 | 
            -
                            domUtils.remove(example.rows[0]);
         | 
| 120 | 
            -
                        }
         | 
| 121 | 
            -
                        me.setColor(color);
         | 
| 122 | 
            -
                        me.updateSortSpan();
         | 
| 123 | 
            -
                    },
         | 
| 124 | 
            -
                    titleColHanler: function () {
         | 
| 125 | 
            -
                        var example = $G("J_example"),
         | 
| 126 | 
            -
                            color = domUtils.getComputedStyle(domUtils.getElementsByTagName(example, "td")[0], "border-color"),
         | 
| 127 | 
            -
                            colArr = example.rows,
         | 
| 128 | 
            -
                            colCount = colArr.length;
         | 
| 129 | 
            -
             | 
| 130 | 
            -
                        if (titleCol.checked) {
         | 
| 131 | 
            -
                            for (var i = 0, node; i < colCount; i++) {
         | 
| 132 | 
            -
                                node = document.createElement("th");
         | 
| 133 | 
            -
                                node.innerHTML = lang.titleName;
         | 
| 134 | 
            -
                                colArr[i].insertBefore(node, colArr[i].children[0]);
         | 
| 135 | 
            -
                            }
         | 
| 136 | 
            -
                        } else {
         | 
| 137 | 
            -
                            for (var i = 0; i < colCount; i++) {
         | 
| 138 | 
            -
                                domUtils.remove(colArr[i].children[0]);
         | 
| 139 | 
            -
                            }
         | 
| 140 | 
            -
                        }
         | 
| 141 | 
            -
                        me.setColor(color);
         | 
| 142 | 
            -
                        me.updateSortSpan();
         | 
| 143 | 
            -
                    },
         | 
| 144 | 
            -
                    captionHanler: function () {
         | 
| 145 | 
            -
                        var example = $G("J_example");
         | 
| 146 | 
            -
                        if (caption.checked) {
         | 
| 147 | 
            -
                            var row = document.createElement('caption');
         | 
| 148 | 
            -
                            row.innerHTML = lang.captionName;
         | 
| 149 | 
            -
                            example.insertBefore(row, example.firstChild);
         | 
| 150 | 
            -
                        } else {
         | 
| 151 | 
            -
                            domUtils.remove(domUtils.getElementsByTagName(example, 'caption')[0]);
         | 
| 152 | 
            -
                        }
         | 
| 153 | 
            -
                    },
         | 
| 154 | 
            -
                    sorttableHanler: function () {
         | 
| 155 | 
            -
                        me.updateSortSpan();
         | 
| 156 | 
            -
                    },
         | 
| 157 | 
            -
                    autoSizeContentHanler: function () {
         | 
| 158 | 
            -
                        var example = $G("J_example");
         | 
| 159 | 
            -
                        example.removeAttribute("width");
         | 
| 160 | 
            -
                    },
         | 
| 161 | 
            -
                    autoSizePageHanler: function () {
         | 
| 162 | 
            -
                        var example = $G("J_example");
         | 
| 163 | 
            -
                        var tds = example.getElementsByTagName(example, "td");
         | 
| 164 | 
            -
                        utils.each(tds, function (td) {
         | 
| 165 | 
            -
                            td.removeAttribute("width");
         | 
| 166 | 
            -
                        });
         | 
| 167 | 
            -
                        example.setAttribute('width', '100%');
         | 
| 168 | 
            -
                    },
         | 
| 169 | 
            -
                    updateSortSpan: function () {
         | 
| 170 | 
            -
                        var example = $G("J_example"),
         | 
| 171 | 
            -
                            row = example.rows[0];
         | 
| 172 | 
            -
             | 
| 173 | 
            -
                        var spans = domUtils.getElementsByTagName(example, "span");
         | 
| 174 | 
            -
                        utils.each(spans, function (span) {
         | 
| 175 | 
            -
                            span.parentNode.removeChild(span);
         | 
| 176 | 
            -
                        });
         | 
| 177 | 
            -
                        if (sorttable.checked) {
         | 
| 178 | 
            -
                            utils.each(row.cells, function (cell, i) {
         | 
| 179 | 
            -
                                var span = document.createElement("span");
         | 
| 180 | 
            -
                                span.innerHTML = "^";
         | 
| 181 | 
            -
                                cell.appendChild(span);
         | 
| 182 | 
            -
                            });
         | 
| 183 | 
            -
                        }
         | 
| 184 | 
            -
                    },
         | 
| 185 | 
            -
                    getColor: function () {
         | 
| 186 | 
            -
                        var start = editor.selection.getStart(), color,
         | 
| 187 | 
            -
                            cell = domUtils.findParentByTagName(start, ["td", "th", "caption"], true);
         | 
| 188 | 
            -
                        color = cell && domUtils.getComputedStyle(cell, "border-color");
         | 
| 189 | 
            -
                        if (!color) color = "#DDDDDD";
         | 
| 190 | 
            -
                        return color;
         | 
| 191 | 
            -
                    },
         | 
| 192 | 
            -
                    setColor: function (color) {
         | 
| 193 | 
            -
                        var example = $G("J_example"),
         | 
| 194 | 
            -
                            arr = domUtils.getElementsByTagName(example, "td").concat(
         | 
| 195 | 
            -
                                domUtils.getElementsByTagName(example, "th"),
         | 
| 196 | 
            -
                                domUtils.getElementsByTagName(example, "caption")
         | 
| 197 | 
            -
                            );
         | 
| 198 | 
            -
             | 
| 199 | 
            -
                        tone.value = color;
         | 
| 200 | 
            -
                        utils.each(arr, function (node) {
         | 
| 201 | 
            -
                            node.style.borderColor = color;
         | 
| 202 | 
            -
                        });
         | 
| 203 | 
            -
             | 
| 204 | 
            -
                    },
         | 
| 205 | 
            -
                    setAutoSize: function () {
         | 
| 206 | 
            -
                        var me = this;
         | 
| 207 | 
            -
                        autoSizePage.checked = true;
         | 
| 208 | 
            -
                        me.autoSizePageHanler();
         | 
| 209 | 
            -
                    }
         | 
| 210 | 
            -
                };
         | 
| 211 | 
            -
             | 
| 212 | 
            -
                new editTable;
         | 
| 213 | 
            -
             | 
| 214 | 
            -
                dialog.onok = function () {
         | 
| 215 | 
            -
                    editor.__hasEnterExecCommand = true;
         | 
| 216 | 
            -
             | 
| 217 | 
            -
                    var checks = {
         | 
| 218 | 
            -
                        title: "inserttitle deletetitle",
         | 
| 219 | 
            -
                        titleCol: "inserttitlecol deletetitlecol",
         | 
| 220 | 
            -
                        caption: "insertcaption deletecaption",
         | 
| 221 | 
            -
                        sorttable: "enablesort disablesort"
         | 
| 222 | 
            -
                    };
         | 
| 223 | 
            -
                    editor.fireEvent('saveScene');
         | 
| 224 | 
            -
                    for (var i in checks) {
         | 
| 225 | 
            -
                        var cmds = checks[i].split(" "),
         | 
| 226 | 
            -
                            input = $G("J_" + i);
         | 
| 227 | 
            -
                        if (input["checked"]) {
         | 
| 228 | 
            -
                            editor.queryCommandState(cmds[0]) != -1 && editor.execCommand(cmds[0]);
         | 
| 229 | 
            -
                        } else {
         | 
| 230 | 
            -
                            editor.queryCommandState(cmds[1]) != -1 && editor.execCommand(cmds[1]);
         | 
| 231 | 
            -
                        }
         | 
| 232 | 
            -
                    }
         | 
| 233 | 
            -
             | 
| 234 | 
            -
                    editor.execCommand("edittable", tone.value);
         | 
| 235 | 
            -
                    autoSizeContent.checked ? editor.execCommand('adaptbytext') : "";
         | 
| 236 | 
            -
                    autoSizePage.checked ? editor.execCommand("adaptbywindow") : "";
         | 
| 237 | 
            -
                    editor.fireEvent('saveScene');
         | 
| 238 | 
            -
             | 
| 239 | 
            -
                    editor.__hasEnterExecCommand = false;
         | 
| 240 | 
            -
                };
         | 
| 241 | 
            -
            })();
         | 
| 1 | 
            +
            /**
         | 
| 2 | 
            +
             * Created with JetBrains PhpStorm.
         | 
| 3 | 
            +
             * User: xuheng
         | 
| 4 | 
            +
             * Date: 12-12-19
         | 
| 5 | 
            +
             * Time: 下午4:55
         | 
| 6 | 
            +
             * To change this template use File | Settings | File Templates.
         | 
| 7 | 
            +
             */
         | 
| 8 | 
            +
            (function () {
         | 
| 9 | 
            +
                var title = $G("J_title"),
         | 
| 10 | 
            +
                    titleCol = $G("J_titleCol"),
         | 
| 11 | 
            +
                    caption = $G("J_caption"),
         | 
| 12 | 
            +
                    sorttable = $G("J_sorttable"),
         | 
| 13 | 
            +
                    autoSizeContent = $G("J_autoSizeContent"),
         | 
| 14 | 
            +
                    autoSizePage = $G("J_autoSizePage"),
         | 
| 15 | 
            +
                    tone = $G("J_tone"),
         | 
| 16 | 
            +
                    me,
         | 
| 17 | 
            +
                    preview = $G("J_preview");
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                var editTable = function () {
         | 
| 20 | 
            +
                    me = this;
         | 
| 21 | 
            +
                    me.init();
         | 
| 22 | 
            +
                };
         | 
| 23 | 
            +
                editTable.prototype = {
         | 
| 24 | 
            +
                    init: function () {
         | 
| 25 | 
            +
                        var colorPiker = new UE.ui.ColorPicker({
         | 
| 26 | 
            +
                                editor: editor
         | 
| 27 | 
            +
                            }),
         | 
| 28 | 
            +
                            colorPop = new UE.ui.Popup({
         | 
| 29 | 
            +
                                editor: editor,
         | 
| 30 | 
            +
                                content: colorPiker
         | 
| 31 | 
            +
                            });
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                        title.checked = editor.queryCommandState("inserttitle") == -1;
         | 
| 34 | 
            +
                        titleCol.checked = editor.queryCommandState("inserttitlecol") == -1;
         | 
| 35 | 
            +
                        caption.checked = editor.queryCommandState("insertcaption") == -1;
         | 
| 36 | 
            +
                        sorttable.checked = editor.queryCommandState("enablesort") == 1;
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                        var enablesortState = editor.queryCommandState("enablesort"),
         | 
| 39 | 
            +
                            disablesortState = editor.queryCommandState("disablesort");
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                        sorttable.checked = !!(enablesortState < 0 && disablesortState >= 0);
         | 
| 42 | 
            +
                        sorttable.disabled = !!(enablesortState < 0 && disablesortState < 0);
         | 
| 43 | 
            +
                        sorttable.title = enablesortState < 0 && disablesortState < 0 ? lang.errorMsg : '';
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                        me.createTable(title.checked, titleCol.checked, caption.checked);
         | 
| 46 | 
            +
                        me.setAutoSize();
         | 
| 47 | 
            +
                        me.setColor(me.getColor());
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                        domUtils.on(title, "click", me.titleHanler);
         | 
| 50 | 
            +
                        domUtils.on(titleCol, "click", me.titleColHanler);
         | 
| 51 | 
            +
                        domUtils.on(caption, "click", me.captionHanler);
         | 
| 52 | 
            +
                        domUtils.on(sorttable, "click", me.sorttableHanler);
         | 
| 53 | 
            +
                        domUtils.on(autoSizeContent, "click", me.autoSizeContentHanler);
         | 
| 54 | 
            +
                        domUtils.on(autoSizePage, "click", me.autoSizePageHanler);
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                        domUtils.on(tone, "click", function () {
         | 
| 57 | 
            +
                            colorPop.showAnchor(tone);
         | 
| 58 | 
            +
                        });
         | 
| 59 | 
            +
                        domUtils.on(document, 'mousedown', function () {
         | 
| 60 | 
            +
                            colorPop.hide();
         | 
| 61 | 
            +
                        });
         | 
| 62 | 
            +
                        colorPiker.addListener("pickcolor", function () {
         | 
| 63 | 
            +
                            me.setColor(arguments[1]);
         | 
| 64 | 
            +
                            colorPop.hide();
         | 
| 65 | 
            +
                        });
         | 
| 66 | 
            +
                        colorPiker.addListener("picknocolor", function () {
         | 
| 67 | 
            +
                            me.setColor("");
         | 
| 68 | 
            +
                            colorPop.hide();
         | 
| 69 | 
            +
                        });
         | 
| 70 | 
            +
                    },
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                    createTable: function (hasTitle, hasTitleCol, hasCaption) {
         | 
| 73 | 
            +
                        var arr = [],
         | 
| 74 | 
            +
                            sortSpan = '<span>^</span>';
         | 
| 75 | 
            +
                        arr.push("<table id='J_example'>");
         | 
| 76 | 
            +
                        if (hasCaption) {
         | 
| 77 | 
            +
                            arr.push("<caption>" + lang.captionName + "</caption>")
         | 
| 78 | 
            +
                        }
         | 
| 79 | 
            +
                        if (hasTitle) {
         | 
| 80 | 
            +
                            arr.push("<tr>");
         | 
| 81 | 
            +
                            if (hasTitleCol) {
         | 
| 82 | 
            +
                                arr.push("<th>" + lang.titleName + "</th>");
         | 
| 83 | 
            +
                            }
         | 
| 84 | 
            +
                            for (var j = 0; j < 5; j++) {
         | 
| 85 | 
            +
                                arr.push("<th>" + lang.titleName + "</th>");
         | 
| 86 | 
            +
                            }
         | 
| 87 | 
            +
                            arr.push("</tr>");
         | 
| 88 | 
            +
                        }
         | 
| 89 | 
            +
                        for (var i = 0; i < 6; i++) {
         | 
| 90 | 
            +
                            arr.push("<tr>");
         | 
| 91 | 
            +
                            if (hasTitleCol) {
         | 
| 92 | 
            +
                                arr.push("<th>" + lang.titleName + "</th>")
         | 
| 93 | 
            +
                            }
         | 
| 94 | 
            +
                            for (var k = 0; k < 5; k++) {
         | 
| 95 | 
            +
                                arr.push("<td>" + lang.cellsName + "</td>")
         | 
| 96 | 
            +
                            }
         | 
| 97 | 
            +
                            arr.push("</tr>");
         | 
| 98 | 
            +
                        }
         | 
| 99 | 
            +
                        arr.push("</table>");
         | 
| 100 | 
            +
                        preview.innerHTML = arr.join("");
         | 
| 101 | 
            +
                        this.updateSortSpan();
         | 
| 102 | 
            +
                    },
         | 
| 103 | 
            +
                    titleHanler: function () {
         | 
| 104 | 
            +
                        var example = $G("J_example"),
         | 
| 105 | 
            +
                            frg = document.createDocumentFragment(),
         | 
| 106 | 
            +
                            color = domUtils.getComputedStyle(domUtils.getElementsByTagName(example, "td")[0], "border-color"),
         | 
| 107 | 
            +
                            colCount = example.rows[0].children.length;
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                        if (title.checked) {
         | 
| 110 | 
            +
                            example.insertRow(0);
         | 
| 111 | 
            +
                            for (var i = 0, node; i < colCount; i++) {
         | 
| 112 | 
            +
                                node = document.createElement("th");
         | 
| 113 | 
            +
                                node.innerHTML = lang.titleName;
         | 
| 114 | 
            +
                                frg.appendChild(node);
         | 
| 115 | 
            +
                            }
         | 
| 116 | 
            +
                            example.rows[0].appendChild(frg);
         | 
| 117 | 
            +
             | 
| 118 | 
            +
                        } else {
         | 
| 119 | 
            +
                            domUtils.remove(example.rows[0]);
         | 
| 120 | 
            +
                        }
         | 
| 121 | 
            +
                        me.setColor(color);
         | 
| 122 | 
            +
                        me.updateSortSpan();
         | 
| 123 | 
            +
                    },
         | 
| 124 | 
            +
                    titleColHanler: function () {
         | 
| 125 | 
            +
                        var example = $G("J_example"),
         | 
| 126 | 
            +
                            color = domUtils.getComputedStyle(domUtils.getElementsByTagName(example, "td")[0], "border-color"),
         | 
| 127 | 
            +
                            colArr = example.rows,
         | 
| 128 | 
            +
                            colCount = colArr.length;
         | 
| 129 | 
            +
             | 
| 130 | 
            +
                        if (titleCol.checked) {
         | 
| 131 | 
            +
                            for (var i = 0, node; i < colCount; i++) {
         | 
| 132 | 
            +
                                node = document.createElement("th");
         | 
| 133 | 
            +
                                node.innerHTML = lang.titleName;
         | 
| 134 | 
            +
                                colArr[i].insertBefore(node, colArr[i].children[0]);
         | 
| 135 | 
            +
                            }
         | 
| 136 | 
            +
                        } else {
         | 
| 137 | 
            +
                            for (var i = 0; i < colCount; i++) {
         | 
| 138 | 
            +
                                domUtils.remove(colArr[i].children[0]);
         | 
| 139 | 
            +
                            }
         | 
| 140 | 
            +
                        }
         | 
| 141 | 
            +
                        me.setColor(color);
         | 
| 142 | 
            +
                        me.updateSortSpan();
         | 
| 143 | 
            +
                    },
         | 
| 144 | 
            +
                    captionHanler: function () {
         | 
| 145 | 
            +
                        var example = $G("J_example");
         | 
| 146 | 
            +
                        if (caption.checked) {
         | 
| 147 | 
            +
                            var row = document.createElement('caption');
         | 
| 148 | 
            +
                            row.innerHTML = lang.captionName;
         | 
| 149 | 
            +
                            example.insertBefore(row, example.firstChild);
         | 
| 150 | 
            +
                        } else {
         | 
| 151 | 
            +
                            domUtils.remove(domUtils.getElementsByTagName(example, 'caption')[0]);
         | 
| 152 | 
            +
                        }
         | 
| 153 | 
            +
                    },
         | 
| 154 | 
            +
                    sorttableHanler: function () {
         | 
| 155 | 
            +
                        me.updateSortSpan();
         | 
| 156 | 
            +
                    },
         | 
| 157 | 
            +
                    autoSizeContentHanler: function () {
         | 
| 158 | 
            +
                        var example = $G("J_example");
         | 
| 159 | 
            +
                        example.removeAttribute("width");
         | 
| 160 | 
            +
                    },
         | 
| 161 | 
            +
                    autoSizePageHanler: function () {
         | 
| 162 | 
            +
                        var example = $G("J_example");
         | 
| 163 | 
            +
                        var tds = example.getElementsByTagName(example, "td");
         | 
| 164 | 
            +
                        utils.each(tds, function (td) {
         | 
| 165 | 
            +
                            td.removeAttribute("width");
         | 
| 166 | 
            +
                        });
         | 
| 167 | 
            +
                        example.setAttribute('width', '100%');
         | 
| 168 | 
            +
                    },
         | 
| 169 | 
            +
                    updateSortSpan: function () {
         | 
| 170 | 
            +
                        var example = $G("J_example"),
         | 
| 171 | 
            +
                            row = example.rows[0];
         | 
| 172 | 
            +
             | 
| 173 | 
            +
                        var spans = domUtils.getElementsByTagName(example, "span");
         | 
| 174 | 
            +
                        utils.each(spans, function (span) {
         | 
| 175 | 
            +
                            span.parentNode.removeChild(span);
         | 
| 176 | 
            +
                        });
         | 
| 177 | 
            +
                        if (sorttable.checked) {
         | 
| 178 | 
            +
                            utils.each(row.cells, function (cell, i) {
         | 
| 179 | 
            +
                                var span = document.createElement("span");
         | 
| 180 | 
            +
                                span.innerHTML = "^";
         | 
| 181 | 
            +
                                cell.appendChild(span);
         | 
| 182 | 
            +
                            });
         | 
| 183 | 
            +
                        }
         | 
| 184 | 
            +
                    },
         | 
| 185 | 
            +
                    getColor: function () {
         | 
| 186 | 
            +
                        var start = editor.selection.getStart(), color,
         | 
| 187 | 
            +
                            cell = domUtils.findParentByTagName(start, ["td", "th", "caption"], true);
         | 
| 188 | 
            +
                        color = cell && domUtils.getComputedStyle(cell, "border-color");
         | 
| 189 | 
            +
                        if (!color) color = "#DDDDDD";
         | 
| 190 | 
            +
                        return color;
         | 
| 191 | 
            +
                    },
         | 
| 192 | 
            +
                    setColor: function (color) {
         | 
| 193 | 
            +
                        var example = $G("J_example"),
         | 
| 194 | 
            +
                            arr = domUtils.getElementsByTagName(example, "td").concat(
         | 
| 195 | 
            +
                                domUtils.getElementsByTagName(example, "th"),
         | 
| 196 | 
            +
                                domUtils.getElementsByTagName(example, "caption")
         | 
| 197 | 
            +
                            );
         | 
| 198 | 
            +
             | 
| 199 | 
            +
                        tone.value = color;
         | 
| 200 | 
            +
                        utils.each(arr, function (node) {
         | 
| 201 | 
            +
                            node.style.borderColor = color;
         | 
| 202 | 
            +
                        });
         | 
| 203 | 
            +
             | 
| 204 | 
            +
                    },
         | 
| 205 | 
            +
                    setAutoSize: function () {
         | 
| 206 | 
            +
                        var me = this;
         | 
| 207 | 
            +
                        autoSizePage.checked = true;
         | 
| 208 | 
            +
                        me.autoSizePageHanler();
         | 
| 209 | 
            +
                    }
         | 
| 210 | 
            +
                };
         | 
| 211 | 
            +
             | 
| 212 | 
            +
                new editTable;
         | 
| 213 | 
            +
             | 
| 214 | 
            +
                dialog.onok = function () {
         | 
| 215 | 
            +
                    editor.__hasEnterExecCommand = true;
         | 
| 216 | 
            +
             | 
| 217 | 
            +
                    var checks = {
         | 
| 218 | 
            +
                        title: "inserttitle deletetitle",
         | 
| 219 | 
            +
                        titleCol: "inserttitlecol deletetitlecol",
         | 
| 220 | 
            +
                        caption: "insertcaption deletecaption",
         | 
| 221 | 
            +
                        sorttable: "enablesort disablesort"
         | 
| 222 | 
            +
                    };
         | 
| 223 | 
            +
                    editor.fireEvent('saveScene');
         | 
| 224 | 
            +
                    for (var i in checks) {
         | 
| 225 | 
            +
                        var cmds = checks[i].split(" "),
         | 
| 226 | 
            +
                            input = $G("J_" + i);
         | 
| 227 | 
            +
                        if (input["checked"]) {
         | 
| 228 | 
            +
                            editor.queryCommandState(cmds[0]) != -1 && editor.execCommand(cmds[0]);
         | 
| 229 | 
            +
                        } else {
         | 
| 230 | 
            +
                            editor.queryCommandState(cmds[1]) != -1 && editor.execCommand(cmds[1]);
         | 
| 231 | 
            +
                        }
         | 
| 232 | 
            +
                    }
         | 
| 233 | 
            +
             | 
| 234 | 
            +
                    editor.execCommand("edittable", tone.value);
         | 
| 235 | 
            +
                    autoSizeContent.checked ? editor.execCommand('adaptbytext') : "";
         | 
| 236 | 
            +
                    autoSizePage.checked ? editor.execCommand("adaptbywindow") : "";
         | 
| 237 | 
            +
                    editor.fireEvent('saveScene');
         | 
| 238 | 
            +
             | 
| 239 | 
            +
                    editor.__hasEnterExecCommand = false;
         | 
| 240 | 
            +
                };
         | 
| 241 | 
            +
            })();
         | 
| @@ -1,62 +1,62 @@ | |
| 1 | 
            -
            <!DOCTYPE html>
         | 
| 2 | 
            -
            <html>
         | 
| 3 | 
            -
            <head>
         | 
| 4 | 
            -
                <title></title>
         | 
| 5 | 
            -
                <script type="text/javascript" src="../internal.js? | 
| 6 | 
            -
                <style type="text/css">
         | 
| 7 | 
            -
                    .section {
         | 
| 8 | 
            -
                        text-align: center;
         | 
| 9 | 
            -
                        margin-top: 10px;
         | 
| 10 | 
            -
                    }
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                    .section input {
         | 
| 13 | 
            -
                        margin-left: 5px;
         | 
| 14 | 
            -
                        width: 70px;
         | 
| 15 | 
            -
                    }
         | 
| 16 | 
            -
                </style>
         | 
| 17 | 
            -
            </head>
         | 
| 18 | 
            -
            <body>
         | 
| 19 | 
            -
            <div class="section">
         | 
| 20 | 
            -
                <span><var id="lang_tdBkColor"></var></span>
         | 
| 21 | 
            -
                <input type="text" id="J_tone"/>
         | 
| 22 | 
            -
            </div>
         | 
| 23 | 
            -
            <script type="text/javascript">
         | 
| 24 | 
            -
                var tone = $G("J_tone"),
         | 
| 25 | 
            -
                    colorPiker = new UE.ui.ColorPicker({
         | 
| 26 | 
            -
                        editor: editor
         | 
| 27 | 
            -
                    }),
         | 
| 28 | 
            -
                    colorPop = new UE.ui.Popup({
         | 
| 29 | 
            -
                        editor: editor,
         | 
| 30 | 
            -
                        content: colorPiker
         | 
| 31 | 
            -
                    });
         | 
| 32 | 
            -
                domUtils.on(tone, "click", function () {
         | 
| 33 | 
            -
                    colorPop.showAnchor(tone);
         | 
| 34 | 
            -
                });
         | 
| 35 | 
            -
                domUtils.on(document, 'mousedown', function () {
         | 
| 36 | 
            -
                    colorPop.hide();
         | 
| 37 | 
            -
                });
         | 
| 38 | 
            -
                colorPiker.addListener("pickcolor", function () {
         | 
| 39 | 
            -
                    tone.value = arguments[1];
         | 
| 40 | 
            -
                    colorPop.hide();
         | 
| 41 | 
            -
                });
         | 
| 42 | 
            -
                colorPiker.addListener("picknocolor", function () {
         | 
| 43 | 
            -
                    tone.value = "";
         | 
| 44 | 
            -
                    colorPop.hide();
         | 
| 45 | 
            -
                });
         | 
| 46 | 
            -
                dialog.onok = function () {
         | 
| 47 | 
            -
                    editor.execCommand("edittd", tone.value);
         | 
| 48 | 
            -
                };
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                var start = editor.selection.getStart(),
         | 
| 51 | 
            -
                    cell = start && domUtils.findParentByTagName(start, ["td", "th"], true);
         | 
| 52 | 
            -
                if (cell) {
         | 
| 53 | 
            -
                    var color = domUtils.getComputedStyle(cell, 'background-color');
         | 
| 54 | 
            -
                    if (/^#/.test(color)) {
         | 
| 55 | 
            -
                        tone.value = color
         | 
| 56 | 
            -
                    }
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                }
         | 
| 59 | 
            -
             | 
| 60 | 
            -
            </script>
         | 
| 61 | 
            -
            </body>
         | 
| 62 | 
            -
            </html>
         | 
| 1 | 
            +
            <!DOCTYPE html>
         | 
| 2 | 
            +
            <html>
         | 
| 3 | 
            +
            <head>
         | 
| 4 | 
            +
                <title></title>
         | 
| 5 | 
            +
                <script type="text/javascript" src="../internal.js?aea0c61c"></script>
         | 
| 6 | 
            +
                <style type="text/css">
         | 
| 7 | 
            +
                    .section {
         | 
| 8 | 
            +
                        text-align: center;
         | 
| 9 | 
            +
                        margin-top: 10px;
         | 
| 10 | 
            +
                    }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                    .section input {
         | 
| 13 | 
            +
                        margin-left: 5px;
         | 
| 14 | 
            +
                        width: 70px;
         | 
| 15 | 
            +
                    }
         | 
| 16 | 
            +
                </style>
         | 
| 17 | 
            +
            </head>
         | 
| 18 | 
            +
            <body>
         | 
| 19 | 
            +
            <div class="section">
         | 
| 20 | 
            +
                <span><var id="lang_tdBkColor"></var></span>
         | 
| 21 | 
            +
                <input type="text" id="J_tone"/>
         | 
| 22 | 
            +
            </div>
         | 
| 23 | 
            +
            <script type="text/javascript">
         | 
| 24 | 
            +
                var tone = $G("J_tone"),
         | 
| 25 | 
            +
                    colorPiker = new UE.ui.ColorPicker({
         | 
| 26 | 
            +
                        editor: editor
         | 
| 27 | 
            +
                    }),
         | 
| 28 | 
            +
                    colorPop = new UE.ui.Popup({
         | 
| 29 | 
            +
                        editor: editor,
         | 
| 30 | 
            +
                        content: colorPiker
         | 
| 31 | 
            +
                    });
         | 
| 32 | 
            +
                domUtils.on(tone, "click", function () {
         | 
| 33 | 
            +
                    colorPop.showAnchor(tone);
         | 
| 34 | 
            +
                });
         | 
| 35 | 
            +
                domUtils.on(document, 'mousedown', function () {
         | 
| 36 | 
            +
                    colorPop.hide();
         | 
| 37 | 
            +
                });
         | 
| 38 | 
            +
                colorPiker.addListener("pickcolor", function () {
         | 
| 39 | 
            +
                    tone.value = arguments[1];
         | 
| 40 | 
            +
                    colorPop.hide();
         | 
| 41 | 
            +
                });
         | 
| 42 | 
            +
                colorPiker.addListener("picknocolor", function () {
         | 
| 43 | 
            +
                    tone.value = "";
         | 
| 44 | 
            +
                    colorPop.hide();
         | 
| 45 | 
            +
                });
         | 
| 46 | 
            +
                dialog.onok = function () {
         | 
| 47 | 
            +
                    editor.execCommand("edittd", tone.value);
         | 
| 48 | 
            +
                };
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                var start = editor.selection.getStart(),
         | 
| 51 | 
            +
                    cell = start && domUtils.findParentByTagName(start, ["td", "th"], true);
         | 
| 52 | 
            +
                if (cell) {
         | 
| 53 | 
            +
                    var color = domUtils.getComputedStyle(cell, 'background-color');
         | 
| 54 | 
            +
                    if (/^#/.test(color)) {
         | 
| 55 | 
            +
                        tone.value = color
         | 
| 56 | 
            +
                    }
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                }
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            </script>
         | 
| 61 | 
            +
            </body>
         | 
| 62 | 
            +
            </html>
         |