@tinymce/tinymce-angular 3.6.0 → 4.2.0

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/README.md CHANGED
@@ -9,6 +9,10 @@ This package is a thin wrapper around [TinyMCE](https://github.com/tinymce/tinym
9
9
  * For the TinyMCE Angular Technical Reference, see: [TinyMCE Documentation - TinyMCE Angular Technical Reference](https://www.tiny.cloud/docs/integrations/angular/#tinymceangulartechnicalreference).
10
10
  * For our quick demos, check out the TinyMCE Angular [Storybook](https://tinymce.github.io/tinymce-angular/).
11
11
 
12
+ ### Support
13
+
14
+ Version 4.0 is intended to support Angular 10. For Angular 8 and below we recommend using previous versions of the wrapper.
15
+
12
16
  ### Issues
13
17
 
14
18
  Have you found an issue with tinymce-angular or do you have a feature request?
@@ -276,6 +276,7 @@
276
276
  this.onGetContent = new core.EventEmitter();
277
277
  this.onHide = new core.EventEmitter();
278
278
  this.onInit = new core.EventEmitter();
279
+ this.onInitNgModel = new core.EventEmitter();
279
280
  this.onLoadContent = new core.EventEmitter();
280
281
  this.onNodeChange = new core.EventEmitter();
281
282
  this.onPostProcess = new core.EventEmitter();
@@ -297,195 +298,72 @@
297
298
  this.onUndo = new core.EventEmitter();
298
299
  this.onVisualAid = new core.EventEmitter();
299
300
  }
300
- __decorate([
301
- core.Output()
302
- ], Events.prototype, "onBeforePaste", void 0);
303
- __decorate([
304
- core.Output()
305
- ], Events.prototype, "onBlur", void 0);
306
- __decorate([
307
- core.Output()
308
- ], Events.prototype, "onClick", void 0);
309
- __decorate([
310
- core.Output()
311
- ], Events.prototype, "onContextMenu", void 0);
312
- __decorate([
313
- core.Output()
314
- ], Events.prototype, "onCopy", void 0);
315
- __decorate([
316
- core.Output()
317
- ], Events.prototype, "onCut", void 0);
318
- __decorate([
319
- core.Output()
320
- ], Events.prototype, "onDblclick", void 0);
321
- __decorate([
322
- core.Output()
323
- ], Events.prototype, "onDrag", void 0);
324
- __decorate([
325
- core.Output()
326
- ], Events.prototype, "onDragDrop", void 0);
327
- __decorate([
328
- core.Output()
329
- ], Events.prototype, "onDragEnd", void 0);
330
- __decorate([
331
- core.Output()
332
- ], Events.prototype, "onDragGesture", void 0);
333
- __decorate([
334
- core.Output()
335
- ], Events.prototype, "onDragOver", void 0);
336
- __decorate([
337
- core.Output()
338
- ], Events.prototype, "onDrop", void 0);
339
- __decorate([
340
- core.Output()
341
- ], Events.prototype, "onFocus", void 0);
342
- __decorate([
343
- core.Output()
344
- ], Events.prototype, "onFocusIn", void 0);
345
- __decorate([
346
- core.Output()
347
- ], Events.prototype, "onFocusOut", void 0);
348
- __decorate([
349
- core.Output()
350
- ], Events.prototype, "onKeyDown", void 0);
351
- __decorate([
352
- core.Output()
353
- ], Events.prototype, "onKeyPress", void 0);
354
- __decorate([
355
- core.Output()
356
- ], Events.prototype, "onKeyUp", void 0);
357
- __decorate([
358
- core.Output()
359
- ], Events.prototype, "onMouseDown", void 0);
360
- __decorate([
361
- core.Output()
362
- ], Events.prototype, "onMouseEnter", void 0);
363
- __decorate([
364
- core.Output()
365
- ], Events.prototype, "onMouseLeave", void 0);
366
- __decorate([
367
- core.Output()
368
- ], Events.prototype, "onMouseMove", void 0);
369
- __decorate([
370
- core.Output()
371
- ], Events.prototype, "onMouseOut", void 0);
372
- __decorate([
373
- core.Output()
374
- ], Events.prototype, "onMouseOver", void 0);
375
- __decorate([
376
- core.Output()
377
- ], Events.prototype, "onMouseUp", void 0);
378
- __decorate([
379
- core.Output()
380
- ], Events.prototype, "onPaste", void 0);
381
- __decorate([
382
- core.Output()
383
- ], Events.prototype, "onSelectionChange", void 0);
384
- __decorate([
385
- core.Output()
386
- ], Events.prototype, "onActivate", void 0);
387
- __decorate([
388
- core.Output()
389
- ], Events.prototype, "onAddUndo", void 0);
390
- __decorate([
391
- core.Output()
392
- ], Events.prototype, "onBeforeAddUndo", void 0);
393
- __decorate([
394
- core.Output()
395
- ], Events.prototype, "onBeforeExecCommand", void 0);
396
- __decorate([
397
- core.Output()
398
- ], Events.prototype, "onBeforeGetContent", void 0);
399
- __decorate([
400
- core.Output()
401
- ], Events.prototype, "onBeforeRenderUI", void 0);
402
- __decorate([
403
- core.Output()
404
- ], Events.prototype, "onBeforeSetContent", void 0);
405
- __decorate([
406
- core.Output()
407
- ], Events.prototype, "onChange", void 0);
408
- __decorate([
409
- core.Output()
410
- ], Events.prototype, "onClearUndos", void 0);
411
- __decorate([
412
- core.Output()
413
- ], Events.prototype, "onDeactivate", void 0);
414
- __decorate([
415
- core.Output()
416
- ], Events.prototype, "onDirty", void 0);
417
- __decorate([
418
- core.Output()
419
- ], Events.prototype, "onExecCommand", void 0);
420
- __decorate([
421
- core.Output()
422
- ], Events.prototype, "onGetContent", void 0);
423
- __decorate([
424
- core.Output()
425
- ], Events.prototype, "onHide", void 0);
426
- __decorate([
427
- core.Output()
428
- ], Events.prototype, "onInit", void 0);
429
- __decorate([
430
- core.Output()
431
- ], Events.prototype, "onLoadContent", void 0);
432
- __decorate([
433
- core.Output()
434
- ], Events.prototype, "onNodeChange", void 0);
435
- __decorate([
436
- core.Output()
437
- ], Events.prototype, "onPostProcess", void 0);
438
- __decorate([
439
- core.Output()
440
- ], Events.prototype, "onPostRender", void 0);
441
- __decorate([
442
- core.Output()
443
- ], Events.prototype, "onPreInit", void 0);
444
- __decorate([
445
- core.Output()
446
- ], Events.prototype, "onPreProcess", void 0);
447
- __decorate([
448
- core.Output()
449
- ], Events.prototype, "onProgressState", void 0);
450
- __decorate([
451
- core.Output()
452
- ], Events.prototype, "onRedo", void 0);
453
- __decorate([
454
- core.Output()
455
- ], Events.prototype, "onRemove", void 0);
456
- __decorate([
457
- core.Output()
458
- ], Events.prototype, "onReset", void 0);
459
- __decorate([
460
- core.Output()
461
- ], Events.prototype, "onSaveContent", void 0);
462
- __decorate([
463
- core.Output()
464
- ], Events.prototype, "onSetAttrib", void 0);
465
- __decorate([
466
- core.Output()
467
- ], Events.prototype, "onObjectResizeStart", void 0);
468
- __decorate([
469
- core.Output()
470
- ], Events.prototype, "onObjectResized", void 0);
471
- __decorate([
472
- core.Output()
473
- ], Events.prototype, "onObjectSelected", void 0);
474
- __decorate([
475
- core.Output()
476
- ], Events.prototype, "onSetContent", void 0);
477
- __decorate([
478
- core.Output()
479
- ], Events.prototype, "onShow", void 0);
480
- __decorate([
481
- core.Output()
482
- ], Events.prototype, "onSubmit", void 0);
483
- __decorate([
484
- core.Output()
485
- ], Events.prototype, "onUndo", void 0);
486
- __decorate([
487
- core.Output()
488
- ], Events.prototype, "onVisualAid", void 0);
301
+ Events.propDecorators = {
302
+ onBeforePaste: [{ type: core.Output }],
303
+ onBlur: [{ type: core.Output }],
304
+ onClick: [{ type: core.Output }],
305
+ onContextMenu: [{ type: core.Output }],
306
+ onCopy: [{ type: core.Output }],
307
+ onCut: [{ type: core.Output }],
308
+ onDblclick: [{ type: core.Output }],
309
+ onDrag: [{ type: core.Output }],
310
+ onDragDrop: [{ type: core.Output }],
311
+ onDragEnd: [{ type: core.Output }],
312
+ onDragGesture: [{ type: core.Output }],
313
+ onDragOver: [{ type: core.Output }],
314
+ onDrop: [{ type: core.Output }],
315
+ onFocus: [{ type: core.Output }],
316
+ onFocusIn: [{ type: core.Output }],
317
+ onFocusOut: [{ type: core.Output }],
318
+ onKeyDown: [{ type: core.Output }],
319
+ onKeyPress: [{ type: core.Output }],
320
+ onKeyUp: [{ type: core.Output }],
321
+ onMouseDown: [{ type: core.Output }],
322
+ onMouseEnter: [{ type: core.Output }],
323
+ onMouseLeave: [{ type: core.Output }],
324
+ onMouseMove: [{ type: core.Output }],
325
+ onMouseOut: [{ type: core.Output }],
326
+ onMouseOver: [{ type: core.Output }],
327
+ onMouseUp: [{ type: core.Output }],
328
+ onPaste: [{ type: core.Output }],
329
+ onSelectionChange: [{ type: core.Output }],
330
+ onActivate: [{ type: core.Output }],
331
+ onAddUndo: [{ type: core.Output }],
332
+ onBeforeAddUndo: [{ type: core.Output }],
333
+ onBeforeExecCommand: [{ type: core.Output }],
334
+ onBeforeGetContent: [{ type: core.Output }],
335
+ onBeforeRenderUI: [{ type: core.Output }],
336
+ onBeforeSetContent: [{ type: core.Output }],
337
+ onChange: [{ type: core.Output }],
338
+ onClearUndos: [{ type: core.Output }],
339
+ onDeactivate: [{ type: core.Output }],
340
+ onDirty: [{ type: core.Output }],
341
+ onExecCommand: [{ type: core.Output }],
342
+ onGetContent: [{ type: core.Output }],
343
+ onHide: [{ type: core.Output }],
344
+ onInit: [{ type: core.Output }],
345
+ onInitNgModel: [{ type: core.Output }],
346
+ onLoadContent: [{ type: core.Output }],
347
+ onNodeChange: [{ type: core.Output }],
348
+ onPostProcess: [{ type: core.Output }],
349
+ onPostRender: [{ type: core.Output }],
350
+ onPreInit: [{ type: core.Output }],
351
+ onPreProcess: [{ type: core.Output }],
352
+ onProgressState: [{ type: core.Output }],
353
+ onRedo: [{ type: core.Output }],
354
+ onRemove: [{ type: core.Output }],
355
+ onReset: [{ type: core.Output }],
356
+ onSaveContent: [{ type: core.Output }],
357
+ onSetAttrib: [{ type: core.Output }],
358
+ onObjectResizeStart: [{ type: core.Output }],
359
+ onObjectResized: [{ type: core.Output }],
360
+ onObjectSelected: [{ type: core.Output }],
361
+ onSetContent: [{ type: core.Output }],
362
+ onShow: [{ type: core.Output }],
363
+ onSubmit: [{ type: core.Output }],
364
+ onUndo: [{ type: core.Output }],
365
+ onVisualAid: [{ type: core.Output }]
366
+ };
489
367
  return Events;
490
368
  }());
491
369
  var validEvents = [
@@ -561,12 +439,29 @@
561
439
  *
562
440
  */
563
441
  var bindHandlers = function (ctx, editor) {
564
- validEvents.forEach(function (eventName) {
442
+ var allowedEvents = getValidEvents(ctx);
443
+ allowedEvents.forEach(function (eventName) {
565
444
  var eventEmitter = ctx[eventName];
566
445
  editor.on(eventName.substring(2), function (event) { return ctx.ngZone.run(function () { return eventEmitter.emit({ event: event, editor: editor }); }); });
567
446
  });
568
447
  };
569
448
  var ɵ0$1 = bindHandlers;
449
+ var getValidEvents = function (ctx) {
450
+ var ignoredEvents = parseStringProperty(ctx.ignoreEvents, []);
451
+ var allowedEvents = parseStringProperty(ctx.allowedEvents, validEvents).filter(function (event) { return validEvents.includes(event) && !ignoredEvents.includes(event); });
452
+ return allowedEvents;
453
+ };
454
+ var ɵ1 = getValidEvents;
455
+ var parseStringProperty = function (property, defaultValue) {
456
+ if (typeof property === 'string') {
457
+ return property.split(',').map(function (value) { return value.trim(); });
458
+ }
459
+ if (Array.isArray(property)) {
460
+ return property;
461
+ }
462
+ return defaultValue;
463
+ };
464
+ var ɵ2 = parseStringProperty;
570
465
  var unique = 0;
571
466
  var uuid = function (prefix) {
572
467
  var date = new Date();
@@ -575,27 +470,27 @@
575
470
  unique++;
576
471
  return prefix + '_' + random + unique + String(time);
577
472
  };
578
- var ɵ1 = uuid;
473
+ var ɵ3 = uuid;
579
474
  var isTextarea = function (element) {
580
475
  return typeof element !== 'undefined' && element.tagName.toLowerCase() === 'textarea';
581
476
  };
582
- var ɵ2 = isTextarea;
477
+ var ɵ4 = isTextarea;
583
478
  var normalizePluginArray = function (plugins) {
584
479
  if (typeof plugins === 'undefined' || plugins === '') {
585
480
  return [];
586
481
  }
587
482
  return Array.isArray(plugins) ? plugins : plugins.split(' ');
588
483
  };
589
- var ɵ3 = normalizePluginArray;
484
+ var ɵ5 = normalizePluginArray;
590
485
  var mergePlugins = function (initPlugins, inputPlugins) {
591
486
  return normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
592
487
  };
593
- var ɵ4 = mergePlugins;
488
+ var ɵ6 = mergePlugins;
594
489
  // tslint:disable-next-line:no-empty
595
490
  var noop = function () { };
596
- var ɵ5 = noop;
491
+ var ɵ7 = noop;
597
492
  var isNullOrUndefined = function (value) { return value === null || value === undefined; };
598
- var ɵ6 = isNullOrUndefined;
493
+ var ɵ8 = isNullOrUndefined;
599
494
 
600
495
  /**
601
496
  * Copyright (c) 2017-present, Ephox, Inc.
@@ -670,7 +565,7 @@
670
565
  _this.cloudChannel = '5';
671
566
  _this.apiKey = 'no-api-key';
672
567
  _this.id = '';
673
- _this.modelEvents = 'change keyup undo redo';
568
+ _this.modelEvents = 'change input undo redo';
674
569
  _this.onTouchedCallback = noop;
675
570
  _this.onChangeCallback = noop;
676
571
  _this._elementRef = elementRef;
@@ -688,14 +583,14 @@
688
583
  this._editor.setMode(val ? 'readonly' : 'design');
689
584
  }
690
585
  },
691
- enumerable: true,
586
+ enumerable: false,
692
587
  configurable: true
693
588
  });
694
589
  Object.defineProperty(EditorComponent.prototype, "editor", {
695
590
  get: function () {
696
591
  return this._editor;
697
592
  },
698
- enumerable: true,
593
+ enumerable: false,
699
594
  configurable: true
700
595
  });
701
596
  EditorComponent.prototype.writeValue = function (value) {
@@ -717,7 +612,7 @@
717
612
  this._editor.setMode(isDisabled ? 'readonly' : 'design');
718
613
  }
719
614
  else if (isDisabled) {
720
- this.init = __assign({}, this.init, { readonly: true });
615
+ this.init = __assign(__assign({}, this.init), { readonly: true });
721
616
  }
722
617
  };
723
618
  EditorComponent.prototype.ngAfterViewInit = function () {
@@ -752,7 +647,7 @@
752
647
  };
753
648
  EditorComponent.prototype.initialise = function () {
754
649
  var _this = this;
755
- var finalInit = __assign({}, this.init, { target: this._element, inline: this.inline, readonly: this.disabled, plugins: mergePlugins(this.init && this.init.plugins, this.plugins), toolbar: this.toolbar || (this.init && this.init.toolbar), setup: function (editor) {
650
+ var finalInit = __assign(__assign({}, this.init), { target: this._element, inline: this.inline, readonly: this.disabled, plugins: mergePlugins(this.init && this.init.plugins, this.plugins), toolbar: this.toolbar || (this.init && this.init.toolbar), setup: function (editor) {
756
651
  _this._editor = editor;
757
652
  editor.on('init', function (e) {
758
653
  _this.initEditor(editor);
@@ -781,7 +676,15 @@
781
676
  _this.ngZone.run(function () { return _this.onChangeCallback(editor.getContent({ format: _this.outputFormat })); });
782
677
  });
783
678
  if (typeof this.initialValue === 'string') {
784
- this.ngZone.run(function () { return editor.setContent(_this.initialValue); });
679
+ this.ngZone.run(function () {
680
+ editor.setContent(_this.initialValue);
681
+ if (editor.getContent() !== _this.initialValue) {
682
+ _this.onChangeCallback(editor.getContent({ format: _this.outputFormat }));
683
+ }
684
+ if (_this.onInitNgModel !== undefined) {
685
+ _this.onInitNgModel.emit(editor);
686
+ }
687
+ });
785
688
  }
786
689
  };
787
690
  EditorComponent.ctorParameters = function () { return [
@@ -790,65 +693,49 @@
790
693
  { type: Object, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
791
694
  { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [TINYMCE_SCRIPT_SRC,] }] }
792
695
  ]; };
793
- __decorate([
794
- core.Input()
795
- ], EditorComponent.prototype, "disabled", null);
796
- __decorate([
797
- core.Input()
798
- ], EditorComponent.prototype, "cloudChannel", void 0);
799
- __decorate([
800
- core.Input()
801
- ], EditorComponent.prototype, "apiKey", void 0);
802
- __decorate([
803
- core.Input()
804
- ], EditorComponent.prototype, "init", void 0);
805
- __decorate([
806
- core.Input()
807
- ], EditorComponent.prototype, "id", void 0);
808
- __decorate([
809
- core.Input()
810
- ], EditorComponent.prototype, "initialValue", void 0);
811
- __decorate([
812
- core.Input()
813
- ], EditorComponent.prototype, "outputFormat", void 0);
814
- __decorate([
815
- core.Input()
816
- ], EditorComponent.prototype, "inline", void 0);
817
- __decorate([
818
- core.Input()
819
- ], EditorComponent.prototype, "tagName", void 0);
820
- __decorate([
821
- core.Input()
822
- ], EditorComponent.prototype, "plugins", void 0);
823
- __decorate([
824
- core.Input()
825
- ], EditorComponent.prototype, "toolbar", void 0);
826
- __decorate([
827
- core.Input()
828
- ], EditorComponent.prototype, "modelEvents", void 0);
829
- EditorComponent = __decorate([
830
- core.Component({
831
- selector: 'editor',
832
- template: '<ng-template></ng-template>',
833
- providers: [EDITOR_COMPONENT_VALUE_ACCESSOR],
834
- styles: [':host { display: block; }']
835
- }),
836
- __param(2, core.Inject(core.PLATFORM_ID)),
837
- __param(3, core.Optional()), __param(3, core.Inject(TINYMCE_SCRIPT_SRC))
838
- ], EditorComponent);
696
+ EditorComponent.decorators = [
697
+ { type: core.Component, args: [{
698
+ selector: 'editor',
699
+ template: '<ng-template></ng-template>',
700
+ providers: [EDITOR_COMPONENT_VALUE_ACCESSOR],
701
+ styles: [':host { display: block; }']
702
+ },] }
703
+ ];
704
+ EditorComponent.ctorParameters = function () { return [
705
+ { type: core.ElementRef },
706
+ { type: core.NgZone },
707
+ { type: Object, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
708
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [TINYMCE_SCRIPT_SRC,] }] }
709
+ ]; };
710
+ EditorComponent.propDecorators = {
711
+ disabled: [{ type: core.Input }],
712
+ cloudChannel: [{ type: core.Input }],
713
+ apiKey: [{ type: core.Input }],
714
+ init: [{ type: core.Input }],
715
+ id: [{ type: core.Input }],
716
+ initialValue: [{ type: core.Input }],
717
+ outputFormat: [{ type: core.Input }],
718
+ inline: [{ type: core.Input }],
719
+ tagName: [{ type: core.Input }],
720
+ plugins: [{ type: core.Input }],
721
+ toolbar: [{ type: core.Input }],
722
+ modelEvents: [{ type: core.Input }],
723
+ allowedEvents: [{ type: core.Input }],
724
+ ignoreEvents: [{ type: core.Input }]
725
+ };
839
726
  return EditorComponent;
840
727
  }(Events));
841
728
 
842
729
  var EditorModule = /** @class */ (function () {
843
730
  function EditorModule() {
844
731
  }
845
- EditorModule = __decorate([
846
- core.NgModule({
847
- imports: [common.CommonModule, forms.FormsModule],
848
- declarations: [EditorComponent],
849
- exports: [EditorComponent]
850
- })
851
- ], EditorModule);
732
+ EditorModule.decorators = [
733
+ { type: core.NgModule, args: [{
734
+ imports: [common.CommonModule, forms.FormsModule],
735
+ declarations: [EditorComponent],
736
+ exports: [EditorComponent]
737
+ },] }
738
+ ];
852
739
  return EditorModule;
853
740
  }());
854
741