1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 9893× 9893× 9893× 9893× 9893× 1× 4958× 4958× 4958× 4958× 1× 4859× 4859× 4859× 4859× 4859× 4859× 4859× 4859× 4859× 4859× 4859× 1× 58× 58× 58× 58× 58× 58× 58× 58× 1× 1× 1× 1× 1× 8161× 8161× 8161× 8161× 1× 4143× 4143× 1× 4006× 4006× 4006× 4006× 4006× 4006× 4006× 4006× 1× 1× 1× 1× 1× 1× 24× 24× 24× 1× 18× 18× 18× 18× 18× 1× 1× 1× 1× 3663× 1× 1899× 1× 1× 18006× 18006× 18006× 1× 1826× 1826× 1× 1× 1× 925× 410× 9107× 9107× 4143× 4964× 4958× 925× 1× 71854× 71854× 1041881× 1041881× 53314× 53314× 3783× 71854× 1× 1424× 763× 1× 154× 80× 7× 7× 80× 80× 80× 80× 60× 60× 80× 80× 80× 80× 80× 80× 80× 80× 45× 80× 7× 1× 1809× 392× 8877× 8877× 4006× 4871× 4853× 18× 18× 1809× 1809× 1× 1× | /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); define(["require", "exports", "./paragraph-format", "./character-format", "../editor/editor-helper", "@syncfusion/ej2-base"], function (require, exports, paragraph_format_1, character_format_1, editor_helper_1, ej2_base_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var WStyle = (function () { function WStyle() { } return WStyle; }()); exports.WStyle = WStyle; var WParagraphStyle = (function (_super) { __extends(WParagraphStyle, _super); function WParagraphStyle(node) { var _this = _super.call(this) || this; _this.ownerBase = node; _this.paragraphFormat = new paragraph_format_1.WParagraphFormat(_this); _this.characterFormat = new character_format_1.WCharacterFormat(_this); return _this; } WParagraphStyle.prototype.clear = function () { Eif (this.characterFormat) { this.characterFormat.clearFormat(); } Eif (this.paragraphFormat) { this.paragraphFormat.clearFormat(); } }; WParagraphStyle.prototype.destroy = function () { Eif (this.characterFormat) { this.characterFormat.destroy(); this.characterFormat = undefined; } Eif (this.paragraphFormat) { this.paragraphFormat.destroy(); this.paragraphFormat = undefined; } this.ownerBase = undefined; this.name = undefined; this.next = undefined; this.basedOn = undefined; this.link = undefined; }; WParagraphStyle.prototype.copyStyle = function (paraStyle) { this.name = paraStyle.name; this.ownerBase = paraStyle.ownerBase; this.type = paraStyle.type; this.next = paraStyle.next; this.basedOn = paraStyle.basedOn; this.link = paraStyle.link; this.characterFormat.copyFormat(paraStyle.characterFormat); this.paragraphFormat.copyFormat(paraStyle.paragraphFormat); }; return WParagraphStyle; }(WStyle)); exports.WParagraphStyle = WParagraphStyle; var WCharacterStyle = (function (_super) { __extends(WCharacterStyle, _super); function WCharacterStyle(node) { var _this = _super.call(this) || this; _this.ownerBase = node; _this.characterFormat = new character_format_1.WCharacterFormat(_this); return _this; } WCharacterStyle.prototype.clear = function () { Eif (this.characterFormat) { this.characterFormat.clearFormat(); } }; WCharacterStyle.prototype.destroy = function () { Eif (this.characterFormat) { this.characterFormat.destroy(); this.characterFormat = undefined; } this.ownerBase = undefined; this.name = undefined; this.next = undefined; this.basedOn = undefined; this.link = undefined; }; WCharacterStyle.prototype.copyStyle = function (charStyle) { this.name = charStyle.name; this.ownerBase = charStyle.ownerBase; this.type = charStyle.type; this.next = charStyle.next; this.basedOn = charStyle.basedOn; this.characterFormat.copyFormat(charStyle.characterFormat); }; return WCharacterStyle; }(WStyle)); exports.WCharacterStyle = WCharacterStyle; var WTableStyle = (function (_super) { __extends(WTableStyle, _super); function WTableStyle(node) { var _this = _super.call(this) || this; _this.ownerBase = node; return _this; } WTableStyle.prototype.destroy = function () { this.ownerBase = undefined; this.name = undefined; this.next = undefined; this.basedOn = undefined; this.link = undefined; }; return WTableStyle; }(WStyle)); exports.WTableStyle = WTableStyle; var WStyles = (function () { function WStyles() { this.collection = []; } Object.defineProperty(WStyles.prototype, "length", { get: function () { return this.collection.length; }, enumerable: true, configurable: true }); WStyles.prototype.remove = function (item) { this.collection = this.collection.filter(function (a) { return (a.name !== item.name); }); }; WStyles.prototype.push = function (item) { Eif (item != null && item !== undefined) { this.collection.push(item); } return 1; }; WStyles.prototype.getItem = function (index) { Eif (this.collection.length > index) { return this.collection[parseInt(index.toString(), 10)]; } return null; }; WStyles.prototype.indexOf = function (item) { return this.collection.indexOf(item); }; WStyles.prototype.contains = function (item) { var index = this.collection.indexOf(item); return index > -1 && index < this.collection.length; }; WStyles.prototype.clear = function () { if (this.collection && this.collection.length > 0) { for (var i = 0; i < this.collection.length; i++) { var style = this.collection[parseInt(i.toString(), 10)]; if (style instanceof WCharacterStyle) { style.clear(); } else if (style instanceof WParagraphStyle) { style.clear(); } } } this.collection = []; }; WStyles.prototype.findByName = function (name, type) { var returnStyle; for (var _i = 0, _a = this.collection; _i < _a.length; _i++) { var value = _a[_i]; if (value.name === name) { returnStyle = value; if (!ej2_base_1.isNullOrUndefined(type)) { Iif (value.type !== type) { returnStyle = undefined; } } } } return returnStyle; }; WStyles.prototype.getStyleNames = function (type) { return this.collection.filter(function (a) { return (a.type === type); }).map(function (a) { return a.name; }); }; WStyles.prototype.getStyles = function (type) { var styles = this.collection.filter(function (a) { return (a.type === type); }).map(function (a) { return a; }); var styleObjects = []; for (var _i = 0, styles_1 = styles; _i < styles_1.length; _i++) { var style = styles_1[_i]; var returnStyle = {}; var returnStyleObject = {}; if (type === 'Paragraph') { returnStyleObject.paragraphFormat = {}; editor_helper_1.HelperMethods.writeParagraphFormat(returnStyleObject.paragraphFormat, true, style.paragraphFormat); } Eif (type !== 'Table') { returnStyleObject.characterFormat = {}; editor_helper_1.HelperMethods.writeCharacterFormat(returnStyleObject.characterFormat, true, style.characterFormat); } returnStyle.name = style.name; returnStyle.style = JSON.stringify(returnStyleObject); Eif (!ej2_base_1.isNullOrUndefined(type)) { returnStyle.type = type; if (returnStyle.type === 'Paragraph' && !ej2_base_1.isNullOrUndefined(style.link)) { returnStyle.type = 'Linked'; } } styleObjects.push(returnStyle); } return styleObjects; }; WStyles.prototype.destroy = function () { if (this.collection && this.collection.length > 0) { for (var i = 0; i < this.collection.length; i++) { var style = this.collection[parseInt(i.toString(), 10)]; if (style instanceof WCharacterStyle) { style.destroy(); } else if (style instanceof WParagraphStyle) { style.destroy(); } else Eif (style instanceof WTableStyle) { style.destroy(); } } } this.collection = []; this.collection = undefined; }; return WStyles; }()); exports.WStyles = WStyles; }); |