* Constructs a editor instance by id. * * @constructor * @method Editor * @param {String} id Unique id for the editor. * @param {Object} options Options for the editor. * @param {tinymce.EditorManager} editorManager EditorManager instance.
(id: string, options: RawEditorOptions, editorManager: EditorManager)
| 283 | * @param {tinymce.EditorManager} editorManager EditorManager instance. |
| 284 | */ |
| 285 | public constructor(id: string, options: RawEditorOptions, editorManager: EditorManager) { |
| 286 | this.editorManager = editorManager; |
| 287 | |
| 288 | // Patch in the EditorObservable functions |
| 289 | extend(this, EditorObservable); |
| 290 | const self = this; |
| 291 | |
| 292 | this.id = id; |
| 293 | this.editorUid = Id.uuidV4(); |
| 294 | this.hidden = false; |
| 295 | const normalizedOptions = normalizeOptions(editorManager.defaultOptions, options); |
| 296 | |
| 297 | this.options = createOptions(self, normalizedOptions, options); |
| 298 | Options.register(self); |
| 299 | |
| 300 | this.userLookup = createUserLookup(this); |
| 301 | |
| 302 | const getOption = this.options.get; |
| 303 | |
| 304 | if (getOption('deprecation_warnings')) { |
| 305 | Deprecations.logWarnings(options, normalizedOptions); |
| 306 | } |
| 307 | |
| 308 | const suffix = getOption('suffix'); |
| 309 | if (suffix) { |
| 310 | editorManager.suffix = suffix; |
| 311 | } |
| 312 | this.suffix = editorManager.suffix; |
| 313 | |
| 314 | const baseUrl = getOption('base_url'); |
| 315 | if (baseUrl) { |
| 316 | editorManager._setBaseUrl(baseUrl); |
| 317 | } |
| 318 | this.baseUri = editorManager.baseURI; |
| 319 | |
| 320 | const referrerPolicy = Options.getReferrerPolicy(self); |
| 321 | if (referrerPolicy) { |
| 322 | ScriptLoader.ScriptLoader._setReferrerPolicy(referrerPolicy); |
| 323 | DOMUtils.DOM.styleSheetLoader._setReferrerPolicy(referrerPolicy); |
| 324 | } |
| 325 | |
| 326 | ScriptLoader.ScriptLoader._setCrossOrigin((url) => { |
| 327 | const crossOrigin = Options.getCrossOrigin(self); |
| 328 | return crossOrigin(url, 'script'); |
| 329 | }); |
| 330 | |
| 331 | DOMUtils.DOM.styleSheetLoader._setCrossOrigin((url) => { |
| 332 | const crossOrigin = Options.getCrossOrigin(self); |
| 333 | return crossOrigin(url, 'stylesheet'); |
| 334 | }); |
| 335 | |
| 336 | const contentCssCors = Options.hasContentCssCors(self); |
| 337 | if (Type.isNonNullable(contentCssCors)) { |
| 338 | DOMUtils.DOM.styleSheetLoader._setContentCssCors(contentCssCors); |
| 339 | } |
| 340 | |
| 341 | AddOnManager.languageLoad = getOption('language_load'); |
| 342 | AddOnManager.baseURL = editorManager.baseURL; |
nothing calls this directly
no test coverage detected