@tectra-ng/editor 0.2.2 → 0.2.4
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
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://tectra-ng.com">
|
|
3
|
+
<img src="https://tectra-ng.com/images/social-preview.png" alt="tectra — Angular UI component library" width="100%" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@tectra-ng/editor"><img src="https://img.shields.io/npm/v/%40tectra-ng%2Feditor?color=2560e4&label=npm" alt="npm version" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@tectra-ng/editor"><img src="https://img.shields.io/npm/dm/%40tectra-ng%2Feditor?color=2560e4" alt="npm downloads" /></a>
|
|
10
|
+
<a href="https://github.com/kulakovskyi/tectra-ng/actions/workflows/ci.yml"><img src="https://github.com/kulakovskyi/tectra-ng/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
|
|
11
|
+
<a href="https://github.com/kulakovskyi/tectra-ng/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-2560e4" alt="MIT license" /></a>
|
|
12
|
+
<a href="https://angular.dev"><img src="https://img.shields.io/badge/Angular-22-dd0031?logo=angular&logoColor=white" alt="Angular 22" /></a>
|
|
13
|
+
<a href="https://www.bestpractices.dev/projects/16576"><img src="https://www.bestpractices.dev/projects/16576/badge" alt="OpenSSF Best Practices" /></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://tectra-ng.com"><b>Documentation</b></a>
|
|
18
|
+
·
|
|
19
|
+
<a href="https://tectra-ng.com/getting-started">Getting started</a>
|
|
20
|
+
·
|
|
21
|
+
<a href="https://www.npmjs.com/package/tectra-ng">The whole kit: tectra-ng</a>
|
|
22
|
+
·
|
|
23
|
+
<a href="https://github.com/kulakovskyi/tectra-ng">GitHub</a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
1
26
|
# Editor
|
|
2
27
|
|
|
3
28
|
```bash
|
|
@@ -435,7 +435,7 @@ function sanitizeEditorHtml(html, document) {
|
|
|
435
435
|
var TxEditorProseStyles = class TxEditorProseStyles {
|
|
436
436
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
437
437
|
minVersion: "12.0.0",
|
|
438
|
-
version: "22.2.
|
|
438
|
+
version: "22.2.5",
|
|
439
439
|
ngImport: i0,
|
|
440
440
|
type: TxEditorProseStyles,
|
|
441
441
|
deps: [],
|
|
@@ -443,7 +443,7 @@ var TxEditorProseStyles = class TxEditorProseStyles {
|
|
|
443
443
|
});
|
|
444
444
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
445
445
|
minVersion: "14.0.0",
|
|
446
|
-
version: "22.2.
|
|
446
|
+
version: "22.2.5",
|
|
447
447
|
type: TxEditorProseStyles,
|
|
448
448
|
isStandalone: true,
|
|
449
449
|
selector: "tx-editor-prose-styles",
|
|
@@ -457,7 +457,7 @@ var TxEditorProseStyles = class TxEditorProseStyles {
|
|
|
457
457
|
};
|
|
458
458
|
i0.ɵɵngDeclareClassMetadata({
|
|
459
459
|
minVersion: "12.0.0",
|
|
460
|
-
version: "22.2.
|
|
460
|
+
version: "22.2.5",
|
|
461
461
|
ngImport: i0,
|
|
462
462
|
type: TxEditorProseStyles,
|
|
463
463
|
decorators: [{
|
|
@@ -541,7 +541,7 @@ var TxEditorContent = class TxEditorContent {
|
|
|
541
541
|
}
|
|
542
542
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
543
543
|
minVersion: "12.0.0",
|
|
544
|
-
version: "22.2.
|
|
544
|
+
version: "22.2.5",
|
|
545
545
|
ngImport: i0,
|
|
546
546
|
type: TxEditorContent,
|
|
547
547
|
deps: [],
|
|
@@ -549,7 +549,7 @@ var TxEditorContent = class TxEditorContent {
|
|
|
549
549
|
});
|
|
550
550
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
551
551
|
minVersion: "17.0.0",
|
|
552
|
-
version: "22.2.
|
|
552
|
+
version: "22.2.5",
|
|
553
553
|
type: TxEditorContent,
|
|
554
554
|
isStandalone: true,
|
|
555
555
|
selector: "tx-editor-content",
|
|
@@ -684,7 +684,7 @@ var TxEditorContent = class TxEditorContent {
|
|
|
684
684
|
};
|
|
685
685
|
i0.ɵɵngDeclareClassMetadata({
|
|
686
686
|
minVersion: "12.0.0",
|
|
687
|
-
version: "22.2.
|
|
687
|
+
version: "22.2.5",
|
|
688
688
|
ngImport: i0,
|
|
689
689
|
type: TxEditorContent,
|
|
690
690
|
decorators: [{
|
|
@@ -26,7 +26,7 @@ import { Decoration, DecorationSet, EditorView } from "prosemirror-view";
|
|
|
26
26
|
var TxEditorToolbarEnd = class TxEditorToolbarEnd {
|
|
27
27
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
28
28
|
minVersion: "12.0.0",
|
|
29
|
-
version: "22.2.
|
|
29
|
+
version: "22.2.5",
|
|
30
30
|
ngImport: i0,
|
|
31
31
|
type: TxEditorToolbarEnd,
|
|
32
32
|
deps: [],
|
|
@@ -34,7 +34,7 @@ var TxEditorToolbarEnd = class TxEditorToolbarEnd {
|
|
|
34
34
|
});
|
|
35
35
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
36
36
|
minVersion: "14.0.0",
|
|
37
|
-
version: "22.2.
|
|
37
|
+
version: "22.2.5",
|
|
38
38
|
type: TxEditorToolbarEnd,
|
|
39
39
|
isStandalone: true,
|
|
40
40
|
selector: "[txEditorToolbarEnd]",
|
|
@@ -43,7 +43,7 @@ var TxEditorToolbarEnd = class TxEditorToolbarEnd {
|
|
|
43
43
|
};
|
|
44
44
|
i0.ɵɵngDeclareClassMetadata({
|
|
45
45
|
minVersion: "12.0.0",
|
|
46
|
-
version: "22.2.
|
|
46
|
+
version: "22.2.5",
|
|
47
47
|
ngImport: i0,
|
|
48
48
|
type: TxEditorToolbarEnd,
|
|
49
49
|
decorators: [{
|
|
@@ -90,12 +90,43 @@ const blockAttrs = {
|
|
|
90
90
|
indent: { default: 0 },
|
|
91
91
|
dir: { default: null }
|
|
92
92
|
};
|
|
93
|
+
const YOUTUBE_HOSTS = /* @__PURE__ */ new Set([
|
|
94
|
+
"youtube.com",
|
|
95
|
+
"www.youtube.com",
|
|
96
|
+
"m.youtube.com",
|
|
97
|
+
"youtube-nocookie.com",
|
|
98
|
+
"www.youtube-nocookie.com"
|
|
99
|
+
]);
|
|
100
|
+
const VIMEO_HOSTS = /* @__PURE__ */ new Set([
|
|
101
|
+
"vimeo.com",
|
|
102
|
+
"www.vimeo.com",
|
|
103
|
+
"player.vimeo.com"
|
|
104
|
+
]);
|
|
105
|
+
const VIDEO_ID = /^[\w-]{6,}$/;
|
|
106
|
+
function parseVideoUrl(value) {
|
|
107
|
+
try {
|
|
108
|
+
return new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(value) ? value : `https://${value}`);
|
|
109
|
+
} catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function youtubeId(url) {
|
|
114
|
+
const host = url.hostname.toLowerCase();
|
|
115
|
+
const [first, second] = url.pathname.split("/").filter(Boolean);
|
|
116
|
+
if (host === "youtu.be") return first ?? null;
|
|
117
|
+
if (!YOUTUBE_HOSTS.has(host)) return null;
|
|
118
|
+
if (first === "watch") return url.searchParams.get("v");
|
|
119
|
+
return first === "embed" || first === "shorts" ? second ?? null : null;
|
|
120
|
+
}
|
|
93
121
|
function toVideoEmbed(value) {
|
|
94
122
|
const url = value.trim();
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
|
|
123
|
+
const parsed = parseVideoUrl(url);
|
|
124
|
+
if (parsed) {
|
|
125
|
+
const youtube = youtubeId(parsed);
|
|
126
|
+
if (youtube && VIDEO_ID.test(youtube)) return `https://www.youtube.com/embed/${youtube}`;
|
|
127
|
+
const vimeo = VIMEO_HOSTS.has(parsed.hostname.toLowerCase()) ? parsed.pathname.split("/").find((part) => /^\d+$/.test(part)) : void 0;
|
|
128
|
+
if (vimeo) return `https://player.vimeo.com/video/${vimeo}`;
|
|
129
|
+
}
|
|
99
130
|
return /^https:\/\/\S+$/i.test(url) ? url : null;
|
|
100
131
|
}
|
|
101
132
|
function styleAttrs(element) {
|
|
@@ -4332,7 +4363,7 @@ var TxEditor = class TxEditor extends TxFormControlBase {
|
|
|
4332
4363
|
}
|
|
4333
4364
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
4334
4365
|
minVersion: "12.0.0",
|
|
4335
|
-
version: "22.2.
|
|
4366
|
+
version: "22.2.5",
|
|
4336
4367
|
ngImport: i0,
|
|
4337
4368
|
type: TxEditor,
|
|
4338
4369
|
deps: [],
|
|
@@ -4340,7 +4371,7 @@ var TxEditor = class TxEditor extends TxFormControlBase {
|
|
|
4340
4371
|
});
|
|
4341
4372
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
4342
4373
|
minVersion: "17.0.0",
|
|
4343
|
-
version: "22.2.
|
|
4374
|
+
version: "22.2.5",
|
|
4344
4375
|
type: TxEditor,
|
|
4345
4376
|
isStandalone: true,
|
|
4346
4377
|
selector: "tx-editor",
|
|
@@ -4981,7 +5012,7 @@ var TxEditor = class TxEditor extends TxFormControlBase {
|
|
|
4981
5012
|
};
|
|
4982
5013
|
i0.ɵɵngDeclareClassMetadata({
|
|
4983
5014
|
minVersion: "12.0.0",
|
|
4984
|
-
version: "22.2.
|
|
5015
|
+
version: "22.2.5",
|
|
4985
5016
|
ngImport: i0,
|
|
4986
5017
|
type: TxEditor,
|
|
4987
5018
|
decorators: [{
|