PageSourceSearch

https://ascvn.com.vn/assets/libs/ckeditor/plugins/div/dialogs/div.js

js ascvn.com.vn collected 2026-10-02 15:38:34 UTC 11,778 bytes, 238 lines download raw bytes

1(function () {
2    function t(a, m, r) {
3        (m.is && m.getCustomData('block_processed')) || (m.is && CKEDITOR.dom.element.setMarker(r, m, 'block_processed', !0), a.push(m));
4    }
5    function q(a, m) {
6        function r() {
7            this.foreach(function (a) {
8                /^(?!vbox|hbox)/.test(a.type) &&
9                    (a.setup ||
10                        (a.setup = function (c) {
11                            a.setValue(c.getAttribute(a.id) || '', 1);
12                        }),
13                    a.commit ||
14                        (a.commit = function (c) {
15                            var f = this.getValue();
16                            if ('dir' != a.id || c.getComputedStyle('direction') != f)
17                                f ? c.setAttribute(a.id, f) : c.removeAttribute(a.id);
18                        }));
19            });
20        }
21        var q = (function () {
22                var g = CKEDITOR.tools.extend({}, CKEDITOR.dtd.$blockLimit);
23                a.config.div_wrapTable && (delete g.td, delete g.th);
24                return g;
25            })(),
26            u = CKEDITOR.dtd.div,
27            n = {},
28            p = [];
29        return {
30            title: a.lang.div.title,
31            minWidth: 400,
32            minHeight: 165,
33            contents: [
34                {
35                    id: 'info',
36                    label: a.lang.common.generalTab,
37                    title: a.lang.common.generalTab,
38                    elements: [
39                        {
40                            type: 'hbox',
41                            widths: ['50%', '50%'],
42                            children: [
43                                {
44                                    id: 'elementStyle',
45                                    type: 'select',
46                                    style: 'width: 100%;',
47                                    label: a.lang.div.styleSelectLabel,
48                                    default: '',
49                                    items: [[a.lang.common.notSet, '']],
50                                    onChange: function () {
51                                        var g = ['info:elementStyle', 'info:class', 'advanced:dir', 'advanced:style'],
52                                            c = this.getDialog(),
53                                            f = c.getModel(a),
54                                            f = (f && f.clone()) || new CKEDITOR.dom.element('div', a.document);
55                                        this.commit(f, !0);
56                                        for (var g = [].concat(g), b = g.length, k, e = 0; e < b; e++)
57                                            (k = c.getContentElement.apply(c, g[e].split(':'))) && k.setup && k.setup(f, !0);
58                                    },
59                                    setup: function (g) {
60                                        for (var c in n) n[c].checkElementRemovable(g, !0, a) && this.setValue(c, 1);
61                                    },
62                                    commit: function (g) {
63                                        var c;
64                                        (c = this.getValue()) ? n[c].applyToObject(g, a) : g.removeAttribute('style');
65                                    },
66                                },
67                                { id: 'class', type: 'text', requiredContent: 'div(cke-xyz)', label: a.lang.common.cssClass, default: '' },
68                            ],
69                        },
70                    ],
71                },
72                {
73                    id: 'advanced',
74                    label: a.lang.common.advancedTab,
75                    title: a.lang.common.advancedTab,
76                    elements: [
77                        {
78                            type: 'vbox',
79                            padding: 1,
80                            children: [
81                                {
82                                    type: 'hbox',
83                                    widths: ['50%', '50%'],
84                                    children: [
85                                        { type: 'text', id: 'id', requiredContent: 'div[id]', label: a.lang.common.id, default: '' },
86                                        {
87                                            type: 'text',
88                                            id: 'lang',
89                                            requiredContent: 'div[lang]',
90                                            label: a.lang.common.langCode,
91                                            default: '',
92                                        },
93                                    ],
94                                },
95                                {
96                                    type: 'hbox',
97                                    children: [
98                                        {
99                                            type: 'text',
100                                            id: 'style',
101                                            requiredContent: 'div{cke-xyz}',
102                                            style: 'width: 100%;',
103                                            label: a.lang.common.cssStyle,
104                                            default: '',
105                                            commit: function (a) {
106                                                a.setAttribute('style', this.getValue());
107                                            },
108                                        },
109                                    ],
110                                },
111                                {
112                                    type: 'hbox',
113                                    children: [
114                                        {
115                                            type: 'text',
116                                            id: 'title',
117                                            requiredContent: 'div[title]',
118                                            style: 'width: 100%;',
119                                            label: a.lang.common.advisoryTitle,
120                                            default: '',
121                                        },
122                                    ],
123                                },
124                                {
125                                    type: 'select',
126                                    id: 'dir',
127                                    requiredContent: 'div[dir]',
128                                    style: 'width: 100%;',
129                                    label: a.lang.common.langDir,
130                                    default: '',
131                                    items: [
132                                        [a.lang.common.notSet, ''],
133                                        [a.lang.common.langDirLtr, 'ltr'],
134                                        [a.lang.common.langDirRtl, 'rtl'],
135                                    ],
136                                },
137                            ],
138                        },
139                    ],
140                },
141            ],
142            getModel: function (a) {
143                return 'editdiv' === m ? CKEDITOR.plugins.div.getSurroundDiv(a) : null;
144            },
145            onLoad: function () {
146                r.call(this);
147                var g = this,
148                    c = this.getContentElement('info', 'elementStyle');
149                a.getStylesSet(function (f) {
150                    var b, k;
151                    if (f)
152                        for (var e = 0; e < f.length; e++)
153                            (k = f[e]),
154                                k.element &&
155                                    'div' == k.element &&
156                                    ((b = k.name),
157                                    (n[b] = k = new CKEDITOR.style(k)),
158                                    a.filter.check(k) && (c.items.push([b, b]), c.add(b, b)));
159                    c[1 < c.items.length ? 'enable' : 'disable']();
160                    setTimeout(function () {
161                        var b = g.getModel(a);
162                        b && c.setup(b);
163                    }, 0);
164                });
165            },
166            onShow: function () {
167                'editdiv' == m && this.setupContent(this.getModel(a));
168            },
169            onOk: function () {
170                if ('editdiv' == m) p = [this.getModel(a)];
171                else {
172                    var g = [],
173                        c = {},
174                        f = [],
175                        b,
176                        k = a.getSelection(),
177                        e = k.getRanges(),
178                        n = k.createBookmarks(),
179                        h,
180                        l;
181                    for (h = 0; h < e.length; h++)
182                        for (l = e[h].createIterator(); (b = l.getNextParagraph()); )
183                            if (b.getName() in q && !b.isReadOnly()) {
184                                var d = b.getChildren();
185                                for (b = 0; b < d.count(); b++) t(f, d.getItem(b), c);
186                            } else {
187                                for (; !u[b.getName()] && !b.equals(e[h].root); ) b = b.getParent();
188                                t(f, b, c);
189                            }
190                    CKEDITOR.dom.element.clearAllMarkers(c);
191                    e = [];
192                    h = null;
193                    for (l = 0; l < f.length; l++)
194                        (b = f[l]),
195                            (d = a.elementPath(b).blockLimit),
196                            d.isReadOnly() && (d = d.getParent()),
197                            a.config.div_wrapTable && d.is(['td', 'th']) && (d = a.elementPath(d.getParent()).blockLimit),
198                            d.equals(h) || ((h = d), e.push([])),
199                            b.getParent() && e[e.length - 1].push(b);
200                    for (h = 0; h < e.length; h++)
201                        if (e[h].length) {
202                            d = e[h][0];
203                            f = d.getParent();
204                            for (b = 1; b < e[h].length; b++) f = f.getCommonAncestor(e[h][b]);
205                            f || (f = a.editable());
206                            l = new CKEDITOR.dom.element('div', a.document);
207                            for (b = 0; b < e[h].length; b++) {
208                                for (d = e[h][b]; d.getParent() && !d.getParent().equals(f); ) d = d.getParent();
209                                e[h][b] = d;
210                            }
211                            for (b = 0; b < e[h].length; b++)
212                                (d = e[h][b]),
213                                    (d.getCustomData && d.getCustomData('block_processed')) ||
214                                        (d.is && CKEDITOR.dom.element.setMarker(c, d, 'block_processed', !0),
215                                        b || l.insertBefore(d),
216                                        l.append(d));
217                            CKEDITOR.dom.element.clearAllMarkers(c);
218                            g.push(l);
219                        }
220                    k.selectBookmarks(n);
221                    p = g;
222                }
223                g = p.length;
224                for (c = 0; c < g; c++) this.commitContent(p[c]), !p[c].getAttribute('style') && p[c].removeAttribute('style');
225                this.hide();
226            },
227            onHide: function () {
228                this.getMode(a) === CKEDITOR.dialog.EDITING_MODE && this.getModel(a).removeCustomData('elementStyle');
229            },
230        };
231    }
232    CKEDITOR.dialog.add('creatediv', function (a) {
233        return q(a, 'creatediv');
234    });
235    CKEDITOR.dialog.add('editdiv', function (a) {
236        return q(a, 'editdiv');
237    });
238})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.