@lofcz/platejs-media 52.0.11
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/LICENSE +24 -0
- package/README.md +21 -0
- package/dist/index-ByCDhWKM.d.ts +138 -0
- package/dist/index-ByCDhWKM.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/react/index.d.ts +4007 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +5095 -0
- package/dist/react/index.js.map +1 -0
- package/dist/src-C-5lYedg.js +417 -0
- package/dist/src-C-5lYedg.js.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Ziad Beyens, Dylan Schiemann, Joe Anderson, Felix Feng
|
|
4
|
+
|
|
5
|
+
Unless otherwise specified in a LICENSE file within an individual package directory,
|
|
6
|
+
this license applies to all files in this repository outside of those package directories.
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
|
16
|
+
all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Plate media plugins
|
|
2
|
+
|
|
3
|
+
This package implements the media plugins for Plate. It allows inserting
|
|
4
|
+
embeddable media such as images, YouTube or Vimeo videos and tweets into your
|
|
5
|
+
editor.
|
|
6
|
+
|
|
7
|
+
Includes:
|
|
8
|
+
|
|
9
|
+
- caption
|
|
10
|
+
- resizable
|
|
11
|
+
- media
|
|
12
|
+
- image
|
|
13
|
+
- iframe
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
- Check out [Media](https://platejs.org/docs/media).
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
[MIT](../../LICENSE)
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { InsertNodesOptions, OverrideEditor, PluginConfig, SetNodesOptions, SlateEditor, TMediaEmbedElement } from "platejs";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/BaseAudioPlugin.d.ts
|
|
4
|
+
declare const BaseAudioPlugin: any;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/lib/BaseFilePlugin.d.ts
|
|
7
|
+
declare const BaseFilePlugin: any;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/lib/BaseVideoPlugin.d.ts
|
|
10
|
+
declare const BaseVideoPlugin: any;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/lib/media/insertMedia.d.ts
|
|
13
|
+
interface InsertMediaOptions extends InsertNodesOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Default onClick is getting the image url by calling this promise before
|
|
16
|
+
* inserting the image.
|
|
17
|
+
*/
|
|
18
|
+
type?: string;
|
|
19
|
+
getUrl?: () => Promise<string>;
|
|
20
|
+
}
|
|
21
|
+
declare const insertMedia: <E extends SlateEditor>(editor: E, {
|
|
22
|
+
getUrl,
|
|
23
|
+
type,
|
|
24
|
+
...options
|
|
25
|
+
}?: InsertMediaOptions) => Promise<void>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/lib/media/parseMediaUrl.d.ts
|
|
28
|
+
type EmbedUrlData = {
|
|
29
|
+
id?: string;
|
|
30
|
+
provider?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
};
|
|
33
|
+
type EmbedUrlParser = (url: string) => EmbedUrlData | undefined;
|
|
34
|
+
declare const parseMediaUrl: (url: string, {
|
|
35
|
+
urlParsers
|
|
36
|
+
}: {
|
|
37
|
+
urlParsers: EmbedUrlParser[];
|
|
38
|
+
}) => EmbedUrlData | undefined;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/lib/media/types.d.ts
|
|
41
|
+
type MediaPluginOptions = {
|
|
42
|
+
isUrl?: (text: string) => boolean;
|
|
43
|
+
/** Transforms the url. */
|
|
44
|
+
transformUrl?: (url: string) => string;
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/lib/image/BaseImagePlugin.d.ts
|
|
48
|
+
type ImageConfig = PluginConfig<'img', {
|
|
49
|
+
/** Disable url embed on insert data. */
|
|
50
|
+
disableEmbedInsert?: boolean;
|
|
51
|
+
/** Disable file upload on insert data. */
|
|
52
|
+
disableUploadInsert?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* An optional method that will upload the image to a server. The method
|
|
55
|
+
* receives the base64 dataUrl of the uploaded image, and should return the
|
|
56
|
+
* URL of the uploaded image.
|
|
57
|
+
*/
|
|
58
|
+
uploadImage?: (dataUrl: ArrayBuffer | string) => ArrayBuffer | Promise<ArrayBuffer | string> | string;
|
|
59
|
+
} & MediaPluginOptions>;
|
|
60
|
+
/** Enables support for images. */
|
|
61
|
+
declare const BaseImagePlugin: any;
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/lib/image/withImageEmbed.d.ts
|
|
64
|
+
/** If inserted text is image url, insert image instead. */
|
|
65
|
+
declare const withImageEmbed: OverrideEditor<ImageConfig>;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/lib/image/withImageUpload.d.ts
|
|
68
|
+
/**
|
|
69
|
+
* Allows for pasting images from clipboard. Not yet: dragging and dropping
|
|
70
|
+
* images, selecting them through a file system dialog.
|
|
71
|
+
*/
|
|
72
|
+
declare const withImageUpload: OverrideEditor<ImageConfig>;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/lib/image/transforms/insertImage.d.ts
|
|
75
|
+
declare const insertImage: (editor: SlateEditor, url: ArrayBuffer | string, options?: InsertNodesOptions) => void;
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/lib/image/transforms/insertImageFromFiles.d.ts
|
|
78
|
+
declare const insertImageFromFiles: (editor: SlateEditor, files: FileList, options?: InsertNodesOptions) => void;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/lib/image/utils/isImageUrl.d.ts
|
|
81
|
+
declare const isImageUrl: (url: string) => boolean;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/lib/media-embed/BaseMediaEmbedPlugin.d.ts
|
|
84
|
+
type MediaEmbedConfig = PluginConfig<'media_embed', MediaPluginOptions>;
|
|
85
|
+
/**
|
|
86
|
+
* Enables support for embeddable media such as YouTube or Vimeo videos,
|
|
87
|
+
* Instagram posts and tweets or Google Maps.
|
|
88
|
+
*/
|
|
89
|
+
declare const BaseMediaEmbedPlugin: any;
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/lib/media-embed/parseIframeUrl.d.ts
|
|
92
|
+
declare const parseIframeUrl: (url: string) => string;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/lib/media-embed/parseTwitterUrl.d.ts
|
|
95
|
+
declare const parseTwitterUrl: (url: string) => EmbedUrlData | undefined;
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/lib/media-embed/parseVideoUrl.d.ts
|
|
98
|
+
declare const VIDEO_PROVIDERS: string[];
|
|
99
|
+
declare const parseVideoUrl: (url: string) => EmbedUrlData | undefined;
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/lib/media-embed/transforms/insertMediaEmbed.d.ts
|
|
102
|
+
declare const insertMediaEmbed: (editor: SlateEditor, {
|
|
103
|
+
url
|
|
104
|
+
}: Partial<TMediaEmbedElement>, options?: InsertNodesOptions) => void;
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/lib/placeholder/BasePlaceholderPlugin.d.ts
|
|
107
|
+
type MediaPlaceholderOptions = {
|
|
108
|
+
rules?: PlaceholderRule[];
|
|
109
|
+
};
|
|
110
|
+
type PlaceholderConfig = PluginConfig<'placeholder', MediaPlaceholderOptions>;
|
|
111
|
+
type PlaceholderRule = {
|
|
112
|
+
mediaType: string;
|
|
113
|
+
};
|
|
114
|
+
declare const BasePlaceholderPlugin: any;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/lib/placeholder/transforms/insertPlaceholder.d.ts
|
|
117
|
+
declare const insertPlaceholder: (editor: SlateEditor, mediaType: string, options?: InsertNodesOptions) => void;
|
|
118
|
+
declare const insertImagePlaceholder: (editor: SlateEditor, options?: InsertNodesOptions) => void;
|
|
119
|
+
declare const insertVideoPlaceholder: (editor: SlateEditor, options?: InsertNodesOptions) => void;
|
|
120
|
+
declare const insertAudioPlaceholder: (editor: SlateEditor, options?: InsertNodesOptions) => void;
|
|
121
|
+
declare const insertFilePlaceholder: (editor: SlateEditor, options?: InsertNodesOptions) => void;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/lib/placeholder/transforms/setMediaNode.d.ts
|
|
124
|
+
type props = {
|
|
125
|
+
type: string;
|
|
126
|
+
url: string;
|
|
127
|
+
id?: string;
|
|
128
|
+
initialHeight?: number;
|
|
129
|
+
initialWidth?: number;
|
|
130
|
+
isUpload?: boolean;
|
|
131
|
+
name?: string;
|
|
132
|
+
placeholderId?: string;
|
|
133
|
+
width?: number;
|
|
134
|
+
};
|
|
135
|
+
declare const setMediaNode: (editor: SlateEditor, props: props, options?: SetNodesOptions) => any;
|
|
136
|
+
//#endregion
|
|
137
|
+
export { insertMedia as A, BaseImagePlugin as C, EmbedUrlParser as D, EmbedUrlData as E, BaseFilePlugin as M, BaseAudioPlugin as N, parseMediaUrl as O, withImageEmbed as S, MediaPluginOptions as T, MediaEmbedConfig as _, insertPlaceholder as a, insertImage as b, MediaPlaceholderOptions as c, insertMediaEmbed as d, VIDEO_PROVIDERS as f, BaseMediaEmbedPlugin as g, parseIframeUrl as h, insertImagePlaceholder as i, BaseVideoPlugin as j, InsertMediaOptions as k, PlaceholderConfig as l, parseTwitterUrl as m, insertAudioPlaceholder as n, insertVideoPlaceholder as o, parseVideoUrl as p, insertFilePlaceholder as r, BasePlaceholderPlugin as s, setMediaNode as t, PlaceholderRule as u, isImageUrl as v, ImageConfig as w, withImageUpload as x, insertImageFromFiles as y };
|
|
138
|
+
//# sourceMappingURL=index-ByCDhWKM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-ByCDhWKM.d.ts","names":[],"sources":["../src/lib/BaseAudioPlugin.ts","../src/lib/BaseFilePlugin.ts","../src/lib/BaseVideoPlugin.ts","../src/lib/media/insertMedia.ts","../src/lib/media/parseMediaUrl.ts","../src/lib/media/types.ts","../src/lib/image/BaseImagePlugin.ts","../src/lib/image/withImageEmbed.ts","../src/lib/image/withImageUpload.ts","../src/lib/image/transforms/insertImage.ts","../src/lib/image/transforms/insertImageFromFiles.ts","../src/lib/image/utils/isImageUrl.ts","../src/lib/media-embed/BaseMediaEmbedPlugin.ts","../src/lib/media-embed/parseIframeUrl.ts","../src/lib/media-embed/parseTwitterUrl.ts","../src/lib/media-embed/parseVideoUrl.ts","../src/lib/media-embed/transforms/insertMediaEmbed.ts","../src/lib/placeholder/BasePlaceholderPlugin.ts","../src/lib/placehol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,OAGX;;;;ACHF,CAAA;ciBYa,uBACH,oBACD,iBACG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as insertMedia, C as BaseImagePlugin, D as EmbedUrlParser, E as EmbedUrlData, M as BaseFilePlugin, N as BaseAudioPlugin, O as parseMediaUrl, S as withImageEmbed, T as MediaPluginOptions, _ as MediaEmbedConfig, a as insertPlaceholder, b as insertImage, c as MediaPlaceholderOptions, d as insertMediaEmbed, f as VIDEO_PROVIDERS, g as BaseMediaEmbedPlugin, h as parseIframeUrl, i as insertImagePlaceholder, j as BaseVideoPlugin, k as InsertMediaOptions, l as PlaceholderConfig, m as parseTwitterUrl, n as insertAudioPlaceholder, o as insertVideoPlaceholder, p as parseVideoUrl, r as insertFilePlaceholder, s as BasePlaceholderPlugin, t as setMediaNode, u as PlaceholderRule, v as isImageUrl, w as ImageConfig, x as withImageUpload, y as insertImageFromFiles } from "./index-ByCDhWKM";
|
|
2
|
+
export { BaseAudioPlugin, BaseFilePlugin, BaseImagePlugin, BaseMediaEmbedPlugin, BasePlaceholderPlugin, BaseVideoPlugin, EmbedUrlData, EmbedUrlParser, ImageConfig, InsertMediaOptions, MediaEmbedConfig, MediaPlaceholderOptions, MediaPluginOptions, PlaceholderConfig, PlaceholderRule, VIDEO_PROVIDERS, insertAudioPlaceholder, insertFilePlaceholder, insertImage, insertImageFromFiles, insertImagePlaceholder, insertMedia, insertMediaEmbed, insertPlaceholder, insertVideoPlaceholder, isImageUrl, parseIframeUrl, parseMediaUrl, parseTwitterUrl, parseVideoUrl, setMediaNode, withImageEmbed, withImageUpload };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { C as BaseFilePlugin, S as BaseVideoPlugin, _ as withImageUpload, a as insertImagePlaceholder, b as insertImageFromFiles, c as insertMediaEmbed, d as parseTwitterUrl, f as BaseMediaEmbedPlugin, g as BaseImagePlugin, h as insertMedia, i as insertFilePlaceholder, l as VIDEO_PROVIDERS, m as parseMediaUrl, n as setMediaNode, o as insertPlaceholder, p as parseIframeUrl, r as insertAudioPlaceholder, s as insertVideoPlaceholder, t as BasePlaceholderPlugin, u as parseVideoUrl, v as withImageEmbed, w as BaseAudioPlugin, x as insertImage, y as isImageUrl } from "./src-C-5lYedg.js";
|
|
2
|
+
|
|
3
|
+
export { BaseAudioPlugin, BaseFilePlugin, BaseImagePlugin, BaseMediaEmbedPlugin, BasePlaceholderPlugin, BaseVideoPlugin, VIDEO_PROVIDERS, insertAudioPlaceholder, insertFilePlaceholder, insertImage, insertImageFromFiles, insertImagePlaceholder, insertMedia, insertMediaEmbed, insertPlaceholder, insertVideoPlaceholder, isImageUrl, parseIframeUrl, parseMediaUrl, parseTwitterUrl, parseVideoUrl, setMediaNode, withImageEmbed, withImageUpload };
|