@atlaskit/editor-core 187.18.1 → 187.18.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 +7 -0
- package/dist/cjs/labs/next/presets/universal.js +2 -1
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/paste/pm-plugins/main.js +2 -6
- package/dist/cjs/utils/clipboard.js +5 -27
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/labs/next/presets/universal.js +2 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/paste/pm-plugins/main.js +2 -2
- package/dist/es2019/utils/clipboard.js +0 -16
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/labs/next/presets/universal.js +2 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/paste/pm-plugins/main.js +2 -2
- package/dist/esm/utils/clipboard.js +4 -23
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/index.d.ts +1 -1
- package/dist/types/utils/clipboard.d.ts +0 -3
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/clipboard.d.ts +0 -3
- package/package.json +4 -3
- package/dist/cjs/plugins/image-upload/index.js +0 -45
- package/dist/cjs/plugins/image-upload/pm-plugins/actions.js +0 -19
- package/dist/cjs/plugins/image-upload/pm-plugins/commands-toolbar.js +0 -19
- package/dist/cjs/plugins/image-upload/pm-plugins/commands.js +0 -40
- package/dist/cjs/plugins/image-upload/pm-plugins/input-rule.js +0 -31
- package/dist/cjs/plugins/image-upload/pm-plugins/main.js +0 -194
- package/dist/cjs/plugins/image-upload/pm-plugins/plugin-key.js +0 -9
- package/dist/cjs/plugins/image-upload/types.js +0 -5
- package/dist/cjs/plugins/image-upload/utils.js +0 -40
- package/dist/cjs/utils/drag-drop.js +0 -19
- package/dist/es2019/plugins/image-upload/index.js +0 -34
- package/dist/es2019/plugins/image-upload/pm-plugins/actions.js +0 -8
- package/dist/es2019/plugins/image-upload/pm-plugins/commands-toolbar.js +0 -12
- package/dist/es2019/plugins/image-upload/pm-plugins/commands.js +0 -28
- package/dist/es2019/plugins/image-upload/pm-plugins/input-rule.js +0 -25
- package/dist/es2019/plugins/image-upload/pm-plugins/main.js +0 -159
- package/dist/es2019/plugins/image-upload/pm-plugins/plugin-key.js +0 -2
- package/dist/es2019/plugins/image-upload/types.js +0 -1
- package/dist/es2019/plugins/image-upload/utils.js +0 -38
- package/dist/es2019/utils/drag-drop.js +0 -9
- package/dist/esm/plugins/image-upload/index.js +0 -37
- package/dist/esm/plugins/image-upload/pm-plugins/actions.js +0 -12
- package/dist/esm/plugins/image-upload/pm-plugins/commands-toolbar.js +0 -12
- package/dist/esm/plugins/image-upload/pm-plugins/commands.js +0 -32
- package/dist/esm/plugins/image-upload/pm-plugins/input-rule.js +0 -23
- package/dist/esm/plugins/image-upload/pm-plugins/main.js +0 -186
- package/dist/esm/plugins/image-upload/pm-plugins/plugin-key.js +0 -2
- package/dist/esm/plugins/image-upload/types.js +0 -1
- package/dist/esm/plugins/image-upload/utils.js +0 -31
- package/dist/esm/utils/drag-drop.js +0 -11
- package/dist/types/plugins/image-upload/index.d.ts +0 -16
- package/dist/types/plugins/image-upload/pm-plugins/actions.d.ts +0 -3
- package/dist/types/plugins/image-upload/pm-plugins/commands-toolbar.d.ts +0 -3
- package/dist/types/plugins/image-upload/pm-plugins/commands.d.ts +0 -5
- package/dist/types/plugins/image-upload/pm-plugins/input-rule.d.ts +0 -5
- package/dist/types/plugins/image-upload/pm-plugins/main.d.ts +0 -4
- package/dist/types/plugins/image-upload/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types/plugins/image-upload/types.d.ts +0 -18
- package/dist/types/plugins/image-upload/utils.d.ts +0 -5
- package/dist/types/utils/drag-drop.d.ts +0 -2
- package/dist/types-ts4.5/plugins/image-upload/index.d.ts +0 -16
- package/dist/types-ts4.5/plugins/image-upload/pm-plugins/actions.d.ts +0 -3
- package/dist/types-ts4.5/plugins/image-upload/pm-plugins/commands-toolbar.d.ts +0 -3
- package/dist/types-ts4.5/plugins/image-upload/pm-plugins/commands.d.ts +0 -5
- package/dist/types-ts4.5/plugins/image-upload/pm-plugins/input-rule.d.ts +0 -5
- package/dist/types-ts4.5/plugins/image-upload/pm-plugins/main.d.ts +0 -4
- package/dist/types-ts4.5/plugins/image-upload/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/image-upload/types.d.ts +0 -18
- package/dist/types-ts4.5/plugins/image-upload/utils.d.ts +0 -5
- package/dist/types-ts4.5/utils/drag-drop.d.ts +0 -2
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
-
import { createExternalMediaNode } from '../utils';
|
|
3
|
-
import { startUpload } from './actions';
|
|
4
|
-
import { stateKey } from './plugin-key';
|
|
5
|
-
export var insertExternalImage = function insertExternalImage(options) {
|
|
6
|
-
return function (state, dispatch) {
|
|
7
|
-
var pluginState = stateKey.getState(state);
|
|
8
|
-
if (!(pluginState !== null && pluginState !== void 0 && pluginState.enabled) || !options.src) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
var mediaNode = createExternalMediaNode(options.src, state.schema);
|
|
12
|
-
if (!mediaNode) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
if (dispatch) {
|
|
16
|
-
dispatch(safeInsert(mediaNode, state.selection.$to.pos)(state.tr).scrollIntoView());
|
|
17
|
-
}
|
|
18
|
-
return true;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export var startImageUpload = function startImageUpload(event) {
|
|
22
|
-
return function (state, dispatch) {
|
|
23
|
-
var pluginState = stateKey.getState(state);
|
|
24
|
-
if (pluginState && !pluginState.enabled) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
if (dispatch) {
|
|
28
|
-
dispatch(startUpload(event)(state.tr));
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createRule, createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
2
|
-
import { createExternalMediaNode } from '../utils';
|
|
3
|
-
export function inputRulePlugin(schema, featureFlags) {
|
|
4
|
-
if (!schema.nodes.media || !schema.nodes.mediaSingle) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
//  should convert to an image
|
|
9
|
-
var imageRule = createRule(/!\[(.*)\]\((\S+)\)$/, function (state, match, start, end) {
|
|
10
|
-
var schema = state.schema;
|
|
11
|
-
var attrs = {
|
|
12
|
-
src: match[2],
|
|
13
|
-
alt: match[1]
|
|
14
|
-
};
|
|
15
|
-
var node = createExternalMediaNode(attrs.src, schema);
|
|
16
|
-
if (node) {
|
|
17
|
-
return state.tr.replaceWith(start, end, node);
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
});
|
|
21
|
-
return createPlugin('image-upload', [imageRule]);
|
|
22
|
-
}
|
|
23
|
-
export default inputRulePlugin;
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
-
import { isClipboardEvent, isPastedFile } from '../../../utils/clipboard';
|
|
8
|
-
import { isDragEvent, isDroppedFile } from '../../../utils/drag-drop';
|
|
9
|
-
import { canInsertMedia, isMediaSelected } from '../utils';
|
|
10
|
-
import { insertExternalImage, startImageUpload } from './commands';
|
|
11
|
-
import { stateKey } from './plugin-key';
|
|
12
|
-
/**
|
|
13
|
-
* Microsoft Office includes a screenshot image when copying text content.
|
|
14
|
-
*
|
|
15
|
-
* This function determines whether or not we can ignore the image if it
|
|
16
|
-
* came from MS Office. We do this by checking for
|
|
17
|
-
*
|
|
18
|
-
* - plain text
|
|
19
|
-
* - HTML text which includes the MS Office namespace
|
|
20
|
-
* - the number of files and the file name/type
|
|
21
|
-
*
|
|
22
|
-
* It is easy to manually verify this using by using Office on Mac
|
|
23
|
-
* (or Excel if on Windows) and pasting into
|
|
24
|
-
* https://evercoder.github.io/clipboard-inspector/
|
|
25
|
-
*
|
|
26
|
-
* Note: image content in Word is stored in the `text/html` portion
|
|
27
|
-
* of the clipboard, not under `files` attachment like the screenshot.
|
|
28
|
-
*
|
|
29
|
-
* @returns boolean True if the paste event contains a screenshot from MS Office
|
|
30
|
-
*/
|
|
31
|
-
var hasScreenshotImageFromMSOffice = function hasScreenshotImageFromMSOffice(ev) {
|
|
32
|
-
var _ref = ev,
|
|
33
|
-
clipboardData = _ref.clipboardData;
|
|
34
|
-
if (!clipboardData || clipboardData.files.length !== 1) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
var textPlain = !!clipboardData.getData('text/plain');
|
|
38
|
-
var textHtml = clipboardData.getData('text/html');
|
|
39
|
-
var isOfficeXMLNamespace = textHtml.includes('urn:schemas-microsoft-com:office:office');
|
|
40
|
-
var file = clipboardData.files[0];
|
|
41
|
-
var isImagePNG = file.type === 'image/png' && file.name === 'image.png';
|
|
42
|
-
return isImagePNG && textPlain && isOfficeXMLNamespace;
|
|
43
|
-
};
|
|
44
|
-
var createReferenceEventFromEvent = function createReferenceEventFromEvent(event) {
|
|
45
|
-
var _event$dataTransfer, _event$clipboardData;
|
|
46
|
-
if (!isDragEvent(event) && !isClipboardEvent(event)) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Get files list and early exit if files is undefined
|
|
51
|
-
var files = isDragEvent(event) ? (_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.files : (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.files;
|
|
52
|
-
if (!files) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Convert filelist into an array
|
|
57
|
-
var filesArray = Array.from(files);
|
|
58
|
-
|
|
59
|
-
// Creating a new DataTransfer object should remove any mutation that could be possible from the original event
|
|
60
|
-
var dataTransfer = filesArray.reduce(function (acc, value) {
|
|
61
|
-
acc.items.add(value);
|
|
62
|
-
return acc;
|
|
63
|
-
}, new DataTransfer());
|
|
64
|
-
return _objectSpread(_objectSpread({
|
|
65
|
-
type: isDragEvent(event) ? 'drop' : 'paste'
|
|
66
|
-
}, isDragEvent(event) && {
|
|
67
|
-
dataTransfer: dataTransfer
|
|
68
|
-
}), isClipboardEvent(event) && {
|
|
69
|
-
clipboardData: dataTransfer
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
var createDOMHandler = function createDOMHandler(pred, _eventName, uploadHandlerReference) {
|
|
73
|
-
return function (view, event) {
|
|
74
|
-
if (!pred(event)) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
var shouldUpload = !hasScreenshotImageFromMSOffice(event);
|
|
78
|
-
var referenceEvent = createReferenceEventFromEvent(event);
|
|
79
|
-
if (shouldUpload && referenceEvent) {
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
event.stopPropagation();
|
|
82
|
-
|
|
83
|
-
// Insert external image into document
|
|
84
|
-
if (uploadHandlerReference.current) {
|
|
85
|
-
uploadHandlerReference.current(referenceEvent, function (options) {
|
|
86
|
-
insertExternalImage(options)(view.state, view.dispatch);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Start image upload
|
|
91
|
-
startImageUpload(referenceEvent)(view.state, view.dispatch);
|
|
92
|
-
}
|
|
93
|
-
return shouldUpload;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
var getNewActiveUpload = function getNewActiveUpload(tr, pluginState) {
|
|
97
|
-
var meta = tr.getMeta(stateKey);
|
|
98
|
-
if (meta && meta.name === 'START_UPLOAD') {
|
|
99
|
-
return {
|
|
100
|
-
event: meta.event
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
return pluginState.activeUpload;
|
|
104
|
-
};
|
|
105
|
-
export var createPlugin = function createPlugin(uploadHandlerReference) {
|
|
106
|
-
return function (_ref2) {
|
|
107
|
-
var dispatch = _ref2.dispatch,
|
|
108
|
-
providerFactory = _ref2.providerFactory;
|
|
109
|
-
return new SafePlugin({
|
|
110
|
-
state: {
|
|
111
|
-
init: function init(_config, state) {
|
|
112
|
-
return {
|
|
113
|
-
active: false,
|
|
114
|
-
enabled: canInsertMedia(state),
|
|
115
|
-
hidden: !state.schema.nodes.media || !state.schema.nodes.mediaSingle
|
|
116
|
-
};
|
|
117
|
-
},
|
|
118
|
-
apply: function apply(tr, pluginState, _oldState, newState) {
|
|
119
|
-
var newActive = isMediaSelected(newState);
|
|
120
|
-
var newEnabled = canInsertMedia(newState);
|
|
121
|
-
var newActiveUpload = getNewActiveUpload(tr, pluginState);
|
|
122
|
-
if (newActive !== pluginState.active || newEnabled !== pluginState.enabled || newActiveUpload !== pluginState.activeUpload) {
|
|
123
|
-
var newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
124
|
-
active: newActive,
|
|
125
|
-
enabled: newEnabled,
|
|
126
|
-
activeUpload: newActiveUpload
|
|
127
|
-
});
|
|
128
|
-
dispatch(stateKey, newPluginState);
|
|
129
|
-
return newPluginState;
|
|
130
|
-
}
|
|
131
|
-
return pluginState;
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
key: stateKey,
|
|
135
|
-
view: function view() {
|
|
136
|
-
var handleProvider = /*#__PURE__*/function () {
|
|
137
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(name, provider) {
|
|
138
|
-
var imageUploadProvider;
|
|
139
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
140
|
-
while (1) switch (_context.prev = _context.next) {
|
|
141
|
-
case 0:
|
|
142
|
-
if (!(name !== 'imageUploadProvider' || !provider)) {
|
|
143
|
-
_context.next = 2;
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
return _context.abrupt("return");
|
|
147
|
-
case 2:
|
|
148
|
-
_context.prev = 2;
|
|
149
|
-
_context.next = 5;
|
|
150
|
-
return provider;
|
|
151
|
-
case 5:
|
|
152
|
-
imageUploadProvider = _context.sent;
|
|
153
|
-
uploadHandlerReference.current = imageUploadProvider;
|
|
154
|
-
_context.next = 12;
|
|
155
|
-
break;
|
|
156
|
-
case 9:
|
|
157
|
-
_context.prev = 9;
|
|
158
|
-
_context.t0 = _context["catch"](2);
|
|
159
|
-
uploadHandlerReference.current = null;
|
|
160
|
-
case 12:
|
|
161
|
-
case "end":
|
|
162
|
-
return _context.stop();
|
|
163
|
-
}
|
|
164
|
-
}, _callee, null, [[2, 9]]);
|
|
165
|
-
}));
|
|
166
|
-
return function handleProvider(_x, _x2) {
|
|
167
|
-
return _ref3.apply(this, arguments);
|
|
168
|
-
};
|
|
169
|
-
}();
|
|
170
|
-
providerFactory.subscribe('imageUploadProvider', handleProvider);
|
|
171
|
-
return {
|
|
172
|
-
destroy: function destroy() {
|
|
173
|
-
uploadHandlerReference.current = null;
|
|
174
|
-
providerFactory.unsubscribe('imageUploadProvider', handleProvider);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
},
|
|
178
|
-
props: {
|
|
179
|
-
handleDOMEvents: {
|
|
180
|
-
drop: createDOMHandler(isDroppedFile, 'atlassian.editor.image.drop', uploadHandlerReference),
|
|
181
|
-
paste: createDOMHandler(isPastedFile, 'atlassian.editor.image.paste', uploadHandlerReference)
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
export var isMediaSelected = function isMediaSelected(state) {
|
|
3
|
-
var media = state.schema.nodes.media;
|
|
4
|
-
return state.selection instanceof NodeSelection && state.selection.node.type === media;
|
|
5
|
-
};
|
|
6
|
-
export var canInsertMedia = function canInsertMedia(state) {
|
|
7
|
-
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
8
|
-
var $to = state.selection.$to;
|
|
9
|
-
if (mediaSingle) {
|
|
10
|
-
for (var d = $to.depth; d >= 0; d--) {
|
|
11
|
-
var index = $to.index(d);
|
|
12
|
-
if ($to.node(d).canReplaceWith(index, index, mediaSingle)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
};
|
|
19
|
-
export var createExternalMediaNode = function createExternalMediaNode(url, schema) {
|
|
20
|
-
var _schema$nodes = schema.nodes,
|
|
21
|
-
media = _schema$nodes.media,
|
|
22
|
-
mediaSingle = _schema$nodes.mediaSingle;
|
|
23
|
-
if (!media || !mediaSingle) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
var mediaNode = media.createChecked({
|
|
27
|
-
type: 'external',
|
|
28
|
-
url: url
|
|
29
|
-
});
|
|
30
|
-
return mediaSingle.createChecked({}, mediaNode);
|
|
31
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Typeguard Function
|
|
2
|
-
export var isDragEvent = function isDragEvent(event) {
|
|
3
|
-
return 'dataTransfer' in event;
|
|
4
|
-
};
|
|
5
|
-
export function isDroppedFile(rawEvent) {
|
|
6
|
-
var e = rawEvent;
|
|
7
|
-
if (!e.dataTransfer) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
return Array.prototype.slice.call(e.dataTransfer.types).indexOf('Files') !== -1;
|
|
11
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Command, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
type ImageUploadActions = {
|
|
3
|
-
startUpload: () => Command;
|
|
4
|
-
};
|
|
5
|
-
type ImageUploadSharedState = {
|
|
6
|
-
active: boolean;
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
hidden: boolean;
|
|
9
|
-
};
|
|
10
|
-
type ImageUploadPlugin = NextEditorPlugin<'imageUpload', {
|
|
11
|
-
actions: ImageUploadActions;
|
|
12
|
-
sharedState: ImageUploadSharedState | undefined;
|
|
13
|
-
}>;
|
|
14
|
-
declare const imageUpload: ImageUploadPlugin;
|
|
15
|
-
export default imageUpload;
|
|
16
|
-
export type { ImageUploadPlugin };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { InsertedImageProperties } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
-
import type { Command } from '../../../types';
|
|
3
|
-
import type { ImageUploadPluginReferenceEvent } from '@atlaskit/editor-common/types';
|
|
4
|
-
export declare const insertExternalImage: (options: InsertedImageProperties) => Command;
|
|
5
|
-
export declare const startImageUpload: (event?: ImageUploadPluginReferenceEvent) => Command;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { FeatureFlags } from '../../../types/feature-flags';
|
|
4
|
-
export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
|
|
5
|
-
export default inputRulePlugin;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { ImageUploadPluginState, UploadHandlerReference } from '../types';
|
|
3
|
-
import type { PMPluginFactoryParams } from '../../../types';
|
|
4
|
-
export declare const createPlugin: (uploadHandlerReference: UploadHandlerReference) => ({ dispatch, providerFactory }: PMPluginFactoryParams) => SafePlugin<ImageUploadPluginState>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ImageUploadPluginReferenceEvent } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { ImageUploadProvider } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
export type { InsertedImageProperties, ImageUploadProvider as ImageUploadHandler, } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
-
export type ImageUploadPluginAction = {
|
|
5
|
-
name: 'START_UPLOAD';
|
|
6
|
-
event?: ImageUploadPluginReferenceEvent;
|
|
7
|
-
};
|
|
8
|
-
export type ImageUploadPluginState = {
|
|
9
|
-
active: boolean;
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
hidden: boolean;
|
|
12
|
-
activeUpload?: {
|
|
13
|
-
event?: ImageUploadPluginReferenceEvent;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export type UploadHandlerReference = {
|
|
17
|
-
current: ImageUploadProvider | null;
|
|
18
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { Schema, Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
export declare const isMediaSelected: (state: EditorState) => boolean;
|
|
4
|
-
export declare const canInsertMedia: (state: EditorState) => boolean;
|
|
5
|
-
export declare const createExternalMediaNode: (url: string, schema: Schema) => Node | null;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Command, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
type ImageUploadActions = {
|
|
3
|
-
startUpload: () => Command;
|
|
4
|
-
};
|
|
5
|
-
type ImageUploadSharedState = {
|
|
6
|
-
active: boolean;
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
hidden: boolean;
|
|
9
|
-
};
|
|
10
|
-
type ImageUploadPlugin = NextEditorPlugin<'imageUpload', {
|
|
11
|
-
actions: ImageUploadActions;
|
|
12
|
-
sharedState: ImageUploadSharedState | undefined;
|
|
13
|
-
}>;
|
|
14
|
-
declare const imageUpload: ImageUploadPlugin;
|
|
15
|
-
export default imageUpload;
|
|
16
|
-
export type { ImageUploadPlugin };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { InsertedImageProperties } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
-
import type { Command } from '../../../types';
|
|
3
|
-
import type { ImageUploadPluginReferenceEvent } from '@atlaskit/editor-common/types';
|
|
4
|
-
export declare const insertExternalImage: (options: InsertedImageProperties) => Command;
|
|
5
|
-
export declare const startImageUpload: (event?: ImageUploadPluginReferenceEvent) => Command;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { FeatureFlags } from '../../../types/feature-flags';
|
|
4
|
-
export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
|
|
5
|
-
export default inputRulePlugin;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { ImageUploadPluginState, UploadHandlerReference } from '../types';
|
|
3
|
-
import type { PMPluginFactoryParams } from '../../../types';
|
|
4
|
-
export declare const createPlugin: (uploadHandlerReference: UploadHandlerReference) => ({ dispatch, providerFactory }: PMPluginFactoryParams) => SafePlugin<ImageUploadPluginState>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ImageUploadPluginReferenceEvent } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { ImageUploadProvider } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
export type { InsertedImageProperties, ImageUploadProvider as ImageUploadHandler, } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
-
export type ImageUploadPluginAction = {
|
|
5
|
-
name: 'START_UPLOAD';
|
|
6
|
-
event?: ImageUploadPluginReferenceEvent;
|
|
7
|
-
};
|
|
8
|
-
export type ImageUploadPluginState = {
|
|
9
|
-
active: boolean;
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
hidden: boolean;
|
|
12
|
-
activeUpload?: {
|
|
13
|
-
event?: ImageUploadPluginReferenceEvent;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export type UploadHandlerReference = {
|
|
17
|
-
current: ImageUploadProvider | null;
|
|
18
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import type { Schema, Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
export declare const isMediaSelected: (state: EditorState) => boolean;
|
|
4
|
-
export declare const canInsertMedia: (state: EditorState) => boolean;
|
|
5
|
-
export declare const createExternalMediaNode: (url: string, schema: Schema) => Node | null;
|