@tinymce/tinymce-webcomponent 1.2.1-rc.20220303082106772.shaee1e7d7 → 2.0.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/CHANGELOG.md CHANGED
@@ -4,32 +4,36 @@ 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
- ## [Unreleased]
7
+ ## 2.0.0
8
+ ### Changed
9
+ - License changed to MIT (from Apache 2) this matches TinyMCE 6 license
10
+ - Changed default cloudChannel to `'6'`.
11
+
8
12
  ### Fixed
9
13
  - Updated dependencies to latest available versions.
10
14
 
11
- ## [1.2.0] - 2021-03-11
15
+ ## 1.2.0 - 2021-03-11
12
16
  ### Fixed
13
17
  - Updated dependencies to latest available versions.
14
18
 
15
- ## [1.1.0] - 2021-01-07
19
+ ## 1.1.0 - 2021-01-07
16
20
  ### Changed
17
21
  - Converted demo server app to TypeScript.
18
22
  - Updated dependencies.
19
23
  - Added eslint.
20
24
  - Adopted beehive-flow branching and versioning process/tooling.
21
25
 
22
- ## [1.0.2] - 2020-09-22
26
+ ## 1.0.2 - 2020-09-22
23
27
  ### Changed
24
28
  - Updated dependencies to latest available versions
25
29
 
26
- ## [1.0.1] - 2020-08-31
30
+ ## 1.0.1 - 2020-08-31
27
31
  ### Added
28
32
  - Added CDN demo.
29
33
 
30
34
  ### Changed
31
35
  - Updated README.md
32
36
 
33
- ## [1.0.0] - 2020-08-27
37
+ ## 1.0.0 - 2020-08-27
34
38
  ### Added
35
39
  - Initial release of web component wrapper around TinyMCE.
package/LICENSE.txt CHANGED
@@ -1,13 +1,21 @@
1
- Copyright 2020-present Tiny Technologies, Inc.
1
+ MIT License
2
2
 
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
3
+ Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
6
4
 
7
- http://www.apache.org/licenses/LICENSE-2.0
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
8
11
 
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -19,7 +19,16 @@
19
19
  return x;
20
20
  };
21
21
 
22
+ const keys = Object.keys;
22
23
  const hasOwnProperty = Object.hasOwnProperty;
24
+ const each = (obj, f) => {
25
+ const props = keys(obj);
26
+ for (let k = 0, len = props.length; k < len; k++) {
27
+ const i = props[k];
28
+ const x = obj[i];
29
+ f(x, i);
30
+ }
31
+ };
23
32
  const has = (obj, key) => hasOwnProperty.call(obj, key);
24
33
 
25
34
  let unique = 0;
@@ -82,7 +91,8 @@
82
91
  Status[Status['Initializing'] = 1] = 'Initializing';
83
92
  Status[Status['Ready'] = 2] = 'Ready';
84
93
  }(Status || (Status = {})));
85
- const lookup = values => key => has(values, key) ? values[key] : key;
94
+ const isLookupKey = (values, key) => has(values, key);
95
+ const lookup = values => key => isLookupKey(values, key) ? values[key] : key;
86
96
  const parseGlobal = resolve;
87
97
  const parseString = identity;
88
98
  const parseFalseOrString = lookup({ 'false': false });
@@ -132,9 +142,12 @@
132
142
  };
133
143
  this._formDataHandler = evt => {
134
144
  const name = this.name;
135
- if (name !== null) {
136
- const data = evt.formData;
137
- data.append(name, this.value);
145
+ if (name != null) {
146
+ const value = this.value;
147
+ if (value != null) {
148
+ const data = evt.formData;
149
+ data.append(name, value);
150
+ }
138
151
  }
139
152
  };
140
153
  this._status = Status.Raw;
@@ -222,7 +235,8 @@
222
235
  }
223
236
  _updateEventAttr(attrKey, attrValue) {
224
237
  const event = attrKey.substring('on-'.length).toLowerCase();
225
- const handler = attrValue !== null ? resolve(attrValue) : undefined;
238
+ const resolved = attrValue !== null ? resolve(attrValue) : undefined;
239
+ const handler = typeof resolved === 'function' ? resolved : undefined;
226
240
  if (this._eventHandlers[event] !== handler) {
227
241
  if (this._editor && this._eventHandlers[event]) {
228
242
  this._editor.off(event, this._eventHandlers[event]);
@@ -288,9 +302,11 @@
288
302
  const attr = this.attributes.item(i);
289
303
  if (attr !== null) {
290
304
  if (attr.name.toLowerCase().startsWith('on-')) {
291
- const event = attr.name.toLowerCase().substr('on-'.length);
305
+ const event = attr.name.toLowerCase().substring('on-'.length);
292
306
  const handler = resolve(attr.value);
293
- handlers[event] = handler;
307
+ if (typeof handler === 'function') {
308
+ handlers[event] = handler;
309
+ }
294
310
  }
295
311
  }
296
312
  }
@@ -316,8 +332,10 @@
316
332
  editor.on('SwitchMode', _e => {
317
333
  this.readonly = this.readonly;
318
334
  });
319
- Object.keys(this._eventHandlers).forEach(event => {
320
- editor.on(event, this._eventHandlers[event]);
335
+ each(this._eventHandlers, (handler, event) => {
336
+ if (handler !== undefined) {
337
+ editor.on(event, handler);
338
+ }
321
339
  });
322
340
  if (typeof baseConfig.setup === 'function') {
323
341
  baseConfig.setup(editor);
@@ -332,7 +350,7 @@
332
350
  if (src) {
333
351
  return src;
334
352
  }
335
- const channel = (_a = this.getAttribute('channel')) !== null && _a !== void 0 ? _a : '5-stable';
353
+ const channel = (_a = this.getAttribute('channel')) !== null && _a !== void 0 ? _a : '6';
336
354
  const apiKey = this.hasAttribute('api-key') ? this.getAttribute('api-key') : 'no-api-key';
337
355
  return `https://cdn.tiny.cloud/1/${ apiKey }/tinymce/${ channel }/tinymce.min.js`;
338
356
  }
@@ -353,7 +371,7 @@
353
371
  this.autofocus = newValue !== null;
354
372
  } else if (attribute === 'placeholder') {
355
373
  this.placeholder = newValue;
356
- } else if (attribute.toLowerCase().startsWith('on')) {
374
+ } else if (attribute.toLowerCase().startsWith('on-')) {
357
375
  this._updateEventAttr(attribute, newValue);
358
376
  }
359
377
  }
@@ -375,11 +393,13 @@
375
393
  this._updateForm();
376
394
  }
377
395
  get value() {
378
- return this._status === Status.Ready ? this._editor.getContent() : undefined;
396
+ var _a, _b;
397
+ return (_b = this._status === Status.Ready ? (_a = this._editor) === null || _a === void 0 ? void 0 : _a.getContent() : undefined) !== null && _b !== void 0 ? _b : null;
379
398
  }
380
399
  set value(newValue) {
381
- if (this._status === Status.Ready) {
382
- this._editor.setContent(newValue);
400
+ var _a;
401
+ if (this._status === Status.Ready && newValue != null) {
402
+ (_a = this._editor) === null || _a === void 0 ? void 0 : _a.setContent(newValue);
383
403
  }
384
404
  }
385
405
  get readonly() {
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "webcomponent"
22
22
  ],
23
23
  "author": "Tiny Technologies",
24
- "license": "Apache-2.0",
24
+ "license": "MIT",
25
25
  "devDependencies": {
26
26
  "@ephox/agar": "^7.0.1",
27
27
  "@ephox/bedrock-client": "^13.0.0",
@@ -33,22 +33,22 @@
33
33
  "@tinymce/eslint-plugin": "^2.0.1",
34
34
  "@types/esm": "^3.2.0",
35
35
  "@types/express": "^4.17.13",
36
- "@types/node": "^17.0.21",
37
- "@typescript-eslint/eslint-plugin": "^5.13.0",
38
- "@typescript-eslint/parser": "^5.13.0",
39
- "eslint": "^8.10.0",
36
+ "@types/node": "^17.0.22",
37
+ "@typescript-eslint/eslint-plugin": "^5.16.0",
38
+ "@typescript-eslint/parser": "^5.16.0",
39
+ "eslint": "^8.11.0",
40
40
  "eslint-plugin-import": "^2.25.4",
41
41
  "eslint-plugin-prefer-arrow": "^1.2.3",
42
42
  "esm": "^3.2.25",
43
43
  "express": "^4.17.3",
44
- "rollup": "^2.69.0",
45
- "tinymce": "^5.10.0",
46
- "ts-loader": "^9.2.7",
47
- "ts-node": "^10.6.0",
44
+ "rollup": "^2.70.1",
45
+ "tinymce": "^6.0.0",
46
+ "ts-loader": "^9.2.8",
47
+ "ts-node": "^10.7.0",
48
48
  "typescript": "~4.6.2",
49
- "webpack": "^5.0.0"
49
+ "webpack": "^5.70.0"
50
50
  },
51
51
  "dependencies": {},
52
- "version": "1.2.1-rc.20220303082106772.shaee1e7d7",
52
+ "version": "2.0.0",
53
53
  "name": "@tinymce/tinymce-webcomponent"
54
54
  }