@tinymce/tinymce-svelte 0.1.1 → 0.1.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/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 0.1.2
8
+ ### Added
9
+ - `cssClass` property for wrapping div
10
+
7
11
  ## 0.1.1
8
12
  ### Added
9
13
  - onDestroy cleanup
package/README.md CHANGED
@@ -54,6 +54,7 @@ The editor component accepts the following properties:
54
54
  modelEvents="input change undo redo"
55
55
  value="value"
56
56
  text="readonly-text-output"
57
+ cssClass="tinymce-wrapper"
57
58
  />
58
59
  ```
59
60
 
@@ -85,6 +86,23 @@ Type: string
85
86
  />
86
87
  ```
87
88
 
89
+ #### CssClass
90
+
91
+ Specifies the name of the class or classes to use for the `div` wrapping the editor.
92
+
93
+ Default value: 'tinymce-wrapper'
94
+ Type: string
95
+
96
+ ##### Example using cssClass
97
+ ```
98
+ <script>
99
+ let editorCss = 'active editor';
100
+ </script>
101
+ <Editor
102
+ cssClass={editorCss}
103
+ />
104
+ ```
105
+
88
106
  #### Id
89
107
 
90
108
  Specified an Id for the editor. Used for retrieving the editor instance using the `tinymce.get('ID')` method.
@@ -52,6 +52,7 @@ export let conf = {};
52
52
  export let modelEvents = 'change input undo redo';
53
53
  export let value = '';
54
54
  export let text = '';
55
+ export let cssClass = 'tinymce-wrapper';
55
56
  let container;
56
57
  let element;
57
58
  let editorRef;
@@ -116,7 +117,7 @@ onDestroy(() => {
116
117
  }
117
118
  });
118
119
  </script>
119
- <div bind:this={container}>
120
+ <div bind:this={container} class={cssClass}>
120
121
  {#if inline}
121
122
  <div id={id} bind:this={element}></div>
122
123
  {:else}
package/dist/index.mjs CHANGED
@@ -360,7 +360,7 @@ function create_else_block(ctx) {
360
360
  },
361
361
  m(target, anchor) {
362
362
  insert(target, textarea, anchor);
363
- /*textarea_binding*/ ctx[16](textarea);
363
+ /*textarea_binding*/ ctx[17](textarea);
364
364
  },
365
365
  p(ctx, dirty) {
366
366
  if (dirty & /*id*/ 1) {
@@ -369,12 +369,12 @@ function create_else_block(ctx) {
369
369
  },
370
370
  d(detaching) {
371
371
  if (detaching) detach(textarea);
372
- /*textarea_binding*/ ctx[16](null);
372
+ /*textarea_binding*/ ctx[17](null);
373
373
  }
374
374
  };
375
375
  }
376
376
 
377
- // (120:2) {#if inline}
377
+ // (121:2) {#if inline}
378
378
  function create_if_block(ctx) {
379
379
  let div;
380
380
 
@@ -385,7 +385,7 @@ function create_if_block(ctx) {
385
385
  },
386
386
  m(target, anchor) {
387
387
  insert(target, div, anchor);
388
- /*div_binding*/ ctx[15](div);
388
+ /*div_binding*/ ctx[16](div);
389
389
  },
390
390
  p(ctx, dirty) {
391
391
  if (dirty & /*id*/ 1) {
@@ -394,7 +394,7 @@ function create_if_block(ctx) {
394
394
  },
395
395
  d(detaching) {
396
396
  if (detaching) detach(div);
397
- /*div_binding*/ ctx[15](null);
397
+ /*div_binding*/ ctx[16](null);
398
398
  }
399
399
  };
400
400
  }
@@ -414,11 +414,12 @@ function create_fragment(ctx) {
414
414
  c() {
415
415
  div = element("div");
416
416
  if_block.c();
417
+ attr(div, "class", /*cssClass*/ ctx[2]);
417
418
  },
418
419
  m(target, anchor) {
419
420
  insert(target, div, anchor);
420
421
  if_block.m(div, null);
421
- /*div_binding_1*/ ctx[17](div);
422
+ /*div_binding_1*/ ctx[18](div);
422
423
  },
423
424
  p(ctx, [dirty]) {
424
425
  if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
@@ -432,13 +433,17 @@ function create_fragment(ctx) {
432
433
  if_block.m(div, null);
433
434
  }
434
435
  }
436
+
437
+ if (dirty & /*cssClass*/ 4) {
438
+ attr(div, "class", /*cssClass*/ ctx[2]);
439
+ }
435
440
  },
436
441
  i: noop,
437
442
  o: noop,
438
443
  d(detaching) {
439
444
  if (detaching) detach(div);
440
445
  if_block.d();
441
- /*div_binding_1*/ ctx[17](null);
446
+ /*div_binding_1*/ ctx[18](null);
442
447
  }
443
448
  };
444
449
  }
@@ -501,6 +506,7 @@ function instance($$self, $$props, $$invalidate) {
501
506
  let { modelEvents = 'change input undo redo' } = $$props;
502
507
  let { value = '' } = $$props;
503
508
  let { text = '' } = $$props;
509
+ let { cssClass = 'tinymce-wrapper' } = $$props;
504
510
  let container;
505
511
  let element;
506
512
  let editorRef;
@@ -526,18 +532,18 @@ function instance($$self, $$props, $$invalidate) {
526
532
  : conf.inline !== undefined ? conf.inline : false,
527
533
  readonly: disabled,
528
534
  setup: editor => {
529
- $$invalidate(12, editorRef = editor);
535
+ $$invalidate(13, editorRef = editor);
530
536
 
531
537
  editor.on('init', () => {
532
538
  editor.setContent(value);
533
539
 
534
540
  // bind model events
535
541
  editor.on(modelEvents, () => {
536
- $$invalidate(13, lastVal = editor.getContent());
542
+ $$invalidate(14, lastVal = editor.getContent());
537
543
 
538
544
  if (lastVal !== value) {
539
- $$invalidate(4, value = lastVal);
540
- $$invalidate(5, text = editor.getContent({ format: 'text' }));
545
+ $$invalidate(5, value = lastVal);
546
+ $$invalidate(6, text = editor.getContent({ format: 'text' }));
541
547
  }
542
548
  });
543
549
  });
@@ -550,7 +556,7 @@ function instance($$self, $$props, $$invalidate) {
550
556
  }
551
557
  });
552
558
 
553
- $$invalidate(3, element.style.visibility = '', element);
559
+ $$invalidate(4, element.style.visibility = '', element);
554
560
  getTinymce().init(finalInit);
555
561
  };
556
562
 
@@ -581,47 +587,48 @@ function instance($$self, $$props, $$invalidate) {
581
587
  function div_binding($$value) {
582
588
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
583
589
  element = $$value;
584
- $$invalidate(3, element);
590
+ $$invalidate(4, element);
585
591
  });
586
592
  }
587
593
 
588
594
  function textarea_binding($$value) {
589
595
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
590
596
  element = $$value;
591
- $$invalidate(3, element);
597
+ $$invalidate(4, element);
592
598
  });
593
599
  }
594
600
 
595
601
  function div_binding_1($$value) {
596
602
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
597
603
  container = $$value;
598
- $$invalidate(2, container);
604
+ $$invalidate(3, container);
599
605
  });
600
606
  }
601
607
 
602
608
  $$self.$$set = $$props => {
603
609
  if ('id' in $$props) $$invalidate(0, id = $$props.id);
604
610
  if ('inline' in $$props) $$invalidate(1, inline = $$props.inline);
605
- if ('disabled' in $$props) $$invalidate(6, disabled = $$props.disabled);
606
- if ('apiKey' in $$props) $$invalidate(7, apiKey = $$props.apiKey);
607
- if ('channel' in $$props) $$invalidate(8, channel = $$props.channel);
608
- if ('scriptSrc' in $$props) $$invalidate(9, scriptSrc = $$props.scriptSrc);
609
- if ('conf' in $$props) $$invalidate(10, conf = $$props.conf);
610
- if ('modelEvents' in $$props) $$invalidate(11, modelEvents = $$props.modelEvents);
611
- if ('value' in $$props) $$invalidate(4, value = $$props.value);
612
- if ('text' in $$props) $$invalidate(5, text = $$props.text);
611
+ if ('disabled' in $$props) $$invalidate(7, disabled = $$props.disabled);
612
+ if ('apiKey' in $$props) $$invalidate(8, apiKey = $$props.apiKey);
613
+ if ('channel' in $$props) $$invalidate(9, channel = $$props.channel);
614
+ if ('scriptSrc' in $$props) $$invalidate(10, scriptSrc = $$props.scriptSrc);
615
+ if ('conf' in $$props) $$invalidate(11, conf = $$props.conf);
616
+ if ('modelEvents' in $$props) $$invalidate(12, modelEvents = $$props.modelEvents);
617
+ if ('value' in $$props) $$invalidate(5, value = $$props.value);
618
+ if ('text' in $$props) $$invalidate(6, text = $$props.text);
619
+ if ('cssClass' in $$props) $$invalidate(2, cssClass = $$props.cssClass);
613
620
  };
614
621
 
615
622
  $$self.$$.update = () => {
616
- if ($$self.$$.dirty & /*editorRef, lastVal, value, disabled, disablindCache*/ 28752) {
623
+ if ($$self.$$.dirty & /*editorRef, lastVal, value, disabled, disablindCache*/ 57504) {
617
624
  {
618
625
  if (editorRef && lastVal !== value) {
619
626
  editorRef.setContent(value);
620
- $$invalidate(5, text = editorRef.getContent({ format: 'text' }));
627
+ $$invalidate(6, text = editorRef.getContent({ format: 'text' }));
621
628
  }
622
629
 
623
630
  if (editorRef && disabled !== disablindCache) {
624
- $$invalidate(14, disablindCache = disabled);
631
+ $$invalidate(15, disablindCache = disabled);
625
632
  editorRef.setMode(disabled ? 'readonly' : 'design');
626
633
  }
627
634
  }
@@ -631,6 +638,7 @@ function instance($$self, $$props, $$invalidate) {
631
638
  return [
632
639
  id,
633
640
  inline,
641
+ cssClass,
634
642
  container,
635
643
  element,
636
644
  value,
@@ -657,14 +665,15 @@ class Editor extends SvelteComponent {
657
665
  init(this, options, instance, create_fragment, safe_not_equal, {
658
666
  id: 0,
659
667
  inline: 1,
660
- disabled: 6,
661
- apiKey: 7,
662
- channel: 8,
663
- scriptSrc: 9,
664
- conf: 10,
665
- modelEvents: 11,
666
- value: 4,
667
- text: 5
668
+ disabled: 7,
669
+ apiKey: 8,
670
+ channel: 9,
671
+ scriptSrc: 10,
672
+ conf: 11,
673
+ modelEvents: 12,
674
+ value: 5,
675
+ text: 6,
676
+ cssClass: 2
668
677
  });
669
678
  }
670
679
  }