PluginProbe
Gutenberg / 18.9.0
Gutenberg v18.9.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / build / annotations / index.js

index.js in Gutenberg 18.9.0, at build/annotations/index.js

714 lines 23.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ "use strict";
3 /******/ // The require scope
4 /******/ var __webpack_require__ = {};
5 /******/
6 /************************************************************************/
7 /******/ /* webpack/runtime/define property getters */
8 /******/ (() => {
9 /******/ // define getter functions for harmony exports
10 /******/ __webpack_require__.d = (exports, definition) => {
11 /******/ for(var key in definition) {
12 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14 /******/ }
15 /******/ }
16 /******/ };
17 /******/ })();
18 /******/
19 /******/ /* webpack/runtime/hasOwnProperty shorthand */
20 /******/ (() => {
21 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
22 /******/ })();
23 /******/
24 /******/ /* webpack/runtime/make namespace object */
25 /******/ (() => {
26 /******/ // define __esModule on exports
27 /******/ __webpack_require__.r = (exports) => {
28 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
29 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
30 /******/ }
31 /******/ Object.defineProperty(exports, '__esModule', { value: true });
32 /******/ };
33 /******/ })();
34 /******/
35 /************************************************************************/
36 var __webpack_exports__ = {};
37 // ESM COMPAT FLAG
38 __webpack_require__.r(__webpack_exports__);
39
40 // EXPORTS
41 __webpack_require__.d(__webpack_exports__, {
42 store: () => (/* reexport */ store)
43 });
44
45 // NAMESPACE OBJECT: ./packages/annotations/build-module/store/selectors.js
46 var selectors_namespaceObject = {};
47 __webpack_require__.r(selectors_namespaceObject);
48 __webpack_require__.d(selectors_namespaceObject, {
49 __experimentalGetAllAnnotationsForBlock: () => (__experimentalGetAllAnnotationsForBlock),
50 __experimentalGetAnnotations: () => (__experimentalGetAnnotations),
51 __experimentalGetAnnotationsForBlock: () => (__experimentalGetAnnotationsForBlock),
52 __experimentalGetAnnotationsForRichText: () => (__experimentalGetAnnotationsForRichText)
53 });
54
55 // NAMESPACE OBJECT: ./packages/annotations/build-module/store/actions.js
56 var actions_namespaceObject = {};
57 __webpack_require__.r(actions_namespaceObject);
58 __webpack_require__.d(actions_namespaceObject, {
59 __experimentalAddAnnotation: () => (__experimentalAddAnnotation),
60 __experimentalRemoveAnnotation: () => (__experimentalRemoveAnnotation),
61 __experimentalRemoveAnnotationsBySource: () => (__experimentalRemoveAnnotationsBySource),
62 __experimentalUpdateAnnotationRange: () => (__experimentalUpdateAnnotationRange)
63 });
64
65 ;// CONCATENATED MODULE: external ["wp","richText"]
66 const external_wp_richText_namespaceObject = window["wp"]["richText"];
67 ;// CONCATENATED MODULE: external ["wp","i18n"]
68 const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
69 ;// CONCATENATED MODULE: ./packages/annotations/build-module/store/constants.js
70 /**
71 * The identifier for the data store.
72 *
73 * @type {string}
74 */
75 const STORE_NAME = 'core/annotations';
76
77 ;// CONCATENATED MODULE: ./packages/annotations/build-module/format/annotation.js
78 /**
79 * WordPress dependencies
80 */
81
82
83 const FORMAT_NAME = 'core/annotation';
84 const ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-';
85 /**
86 * Internal dependencies
87 */
88
89
90 /**
91 * Applies given annotations to the given record.
92 *
93 * @param {Object} record The record to apply annotations to.
94 * @param {Array} annotations The annotation to apply.
95 * @return {Object} A record with the annotations applied.
96 */
97 function applyAnnotations(record, annotations = []) {
98 annotations.forEach(annotation => {
99 let {
100 start,
101 end
102 } = annotation;
103 if (start > record.text.length) {
104 start = record.text.length;
105 }
106 if (end > record.text.length) {
107 end = record.text.length;
108 }
109 const className = ANNOTATION_ATTRIBUTE_PREFIX + annotation.source;
110 const id = ANNOTATION_ATTRIBUTE_PREFIX + annotation.id;
111 record = (0,external_wp_richText_namespaceObject.applyFormat)(record, {
112 type: FORMAT_NAME,
113 attributes: {
114 className,
115 id
116 }
117 }, start, end);
118 });
119 return record;
120 }
121
122 /**
123 * Removes annotations from the given record.
124 *
125 * @param {Object} record Record to remove annotations from.
126 * @return {Object} The cleaned record.
127 */
128 function removeAnnotations(record) {
129 return removeFormat(record, 'core/annotation', 0, record.text.length);
130 }
131
132 /**
133 * Retrieves the positions of annotations inside an array of formats.
134 *
135 * @param {Array} formats Formats with annotations in there.
136 * @return {Object} ID keyed positions of annotations.
137 */
138 function retrieveAnnotationPositions(formats) {
139 const positions = {};
140 formats.forEach((characterFormats, i) => {
141 characterFormats = characterFormats || [];
142 characterFormats = characterFormats.filter(format => format.type === FORMAT_NAME);
143 characterFormats.forEach(format => {
144 let {
145 id
146 } = format.attributes;
147 id = id.replace(ANNOTATION_ATTRIBUTE_PREFIX, '');
148 if (!positions.hasOwnProperty(id)) {
149 positions[id] = {
150 start: i
151 };
152 }
153
154 // Annotations refer to positions between characters.
155 // Formats refer to the character themselves.
156 // So we need to adjust for that here.
157 positions[id].end = i + 1;
158 });
159 });
160 return positions;
161 }
162
163 /**
164 * Updates annotations in the state based on positions retrieved from RichText.
165 *
166 * @param {Array} annotations The annotations that are currently applied.
167 * @param {Array} positions The current positions of the given annotations.
168 * @param {Object} actions
169 * @param {Function} actions.removeAnnotation Function to remove an annotation from the state.
170 * @param {Function} actions.updateAnnotationRange Function to update an annotation range in the state.
171 */
172 function updateAnnotationsWithPositions(annotations, positions, {
173 removeAnnotation,
174 updateAnnotationRange
175 }) {
176 annotations.forEach(currentAnnotation => {
177 const position = positions[currentAnnotation.id];
178 // If we cannot find an annotation, delete it.
179 if (!position) {
180 // Apparently the annotation has been removed, so remove it from the state:
181 // Remove...
182 removeAnnotation(currentAnnotation.id);
183 return;
184 }
185 const {
186 start,
187 end
188 } = currentAnnotation;
189 if (start !== position.start || end !== position.end) {
190 updateAnnotationRange(currentAnnotation.id, position.start, position.end);
191 }
192 });
193 }
194 const annotation = {
195 name: FORMAT_NAME,
196 title: (0,external_wp_i18n_namespaceObject.__)('Annotation'),
197 tagName: 'mark',
198 className: 'annotation-text',
199 attributes: {
200 className: 'class',
201 id: 'id'
202 },
203 edit() {
204 return null;
205 },
206 __experimentalGetPropsForEditableTreePreparation(select, {
207 richTextIdentifier,
208 blockClientId
209 }) {
210 return {
211 annotations: select(STORE_NAME).__experimentalGetAnnotationsForRichText(blockClientId, richTextIdentifier)
212 };
213 },
214 __experimentalCreatePrepareEditableTree({
215 annotations
216 }) {
217 return (formats, text) => {
218 if (annotations.length === 0) {
219 return formats;
220 }
221 let record = {
222 formats,
223 text
224 };
225 record = applyAnnotations(record, annotations);
226 return record.formats;
227 };
228 },
229 __experimentalGetPropsForEditableTreeChangeHandler(dispatch) {
230 return {
231 removeAnnotation: dispatch(STORE_NAME).__experimentalRemoveAnnotation,
232 updateAnnotationRange: dispatch(STORE_NAME).__experimentalUpdateAnnotationRange
233 };
234 },
235 __experimentalCreateOnChangeEditableValue(props) {
236 return formats => {
237 const positions = retrieveAnnotationPositions(formats);
238 const {
239 removeAnnotation,
240 updateAnnotationRange,
241 annotations
242 } = props;
243 updateAnnotationsWithPositions(annotations, positions, {
244 removeAnnotation,
245 updateAnnotationRange
246 });
247 };
248 }
249 };
250
251 ;// CONCATENATED MODULE: ./packages/annotations/build-module/format/index.js
252 /**
253 * WordPress dependencies
254 */
255
256
257 /**
258 * Internal dependencies
259 */
260
261 const {
262 name: format_name,
263 ...settings
264 } = annotation;
265 (0,external_wp_richText_namespaceObject.registerFormatType)(format_name, settings);
266
267 ;// CONCATENATED MODULE: external ["wp","hooks"]
268 const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
269 ;// CONCATENATED MODULE: external ["wp","data"]
270 const external_wp_data_namespaceObject = window["wp"]["data"];
271 ;// CONCATENATED MODULE: ./packages/annotations/build-module/block/index.js
272 /**
273 * WordPress dependencies
274 */
275
276
277
278 /**
279 * Internal dependencies
280 */
281
282 /**
283 * Adds annotation className to the block-list-block component.
284 *
285 * @param {Object} OriginalComponent The original BlockListBlock component.
286 * @return {Object} The enhanced component.
287 */
288 const addAnnotationClassName = OriginalComponent => {
289 return (0,external_wp_data_namespaceObject.withSelect)((select, {
290 clientId,
291 className
292 }) => {
293 const annotations = select(STORE_NAME).__experimentalGetAnnotationsForBlock(clientId);
294 return {
295 className: annotations.map(annotation => {
296 return 'is-annotated-by-' + annotation.source;
297 }).concat(className).filter(Boolean).join(' ')
298 };
299 })(OriginalComponent);
300 };
301 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/annotations', addAnnotationClassName);
302
303 ;// CONCATENATED MODULE: ./packages/annotations/build-module/store/reducer.js
304 /**
305 * Filters an array based on the predicate, but keeps the reference the same if
306 * the array hasn't changed.
307 *
308 * @param {Array} collection The collection to filter.
309 * @param {Function} predicate Function that determines if the item should stay
310 * in the array.
311 * @return {Array} Filtered array.
312 */
313 function filterWithReference(collection, predicate) {
314 const filteredCollection = collection.filter(predicate);
315 return collection.length === filteredCollection.length ? collection : filteredCollection;
316 }
317
318 /**
319 * Creates a new object with the same keys, but with `callback()` called as
320 * a transformer function on each of the values.
321 *
322 * @param {Object} obj The object to transform.
323 * @param {Function} callback The function to transform each object value.
324 * @return {Array} Transformed object.
325 */
326 const mapValues = (obj, callback) => Object.entries(obj).reduce((acc, [key, value]) => ({
327 ...acc,
328 [key]: callback(value)
329 }), {});
330
331 /**
332 * Verifies whether the given annotations is a valid annotation.
333 *
334 * @param {Object} annotation The annotation to verify.
335 * @return {boolean} Whether the given annotation is valid.
336 */
337 function isValidAnnotationRange(annotation) {
338 return typeof annotation.start === 'number' && typeof annotation.end === 'number' && annotation.start <= annotation.end;
339 }
340
341 /**
342 * Reducer managing annotations.
343 *
344 * @param {Object} state The annotations currently shown in the editor.
345 * @param {Object} action Dispatched action.
346 *
347 * @return {Array} Updated state.
348 */
349 function annotations(state = {}, action) {
350 var _state$blockClientId;
351 switch (action.type) {
352 case 'ANNOTATION_ADD':
353 const blockClientId = action.blockClientId;
354 const newAnnotation = {
355 id: action.id,
356 blockClientId,
357 richTextIdentifier: action.richTextIdentifier,
358 source: action.source,
359 selector: action.selector,
360 range: action.range
361 };
362 if (newAnnotation.selector === 'range' && !isValidAnnotationRange(newAnnotation.range)) {
363 return state;
364 }
365 const previousAnnotationsForBlock = (_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : [];
366 return {
367 ...state,
368 [blockClientId]: [...previousAnnotationsForBlock, newAnnotation]
369 };
370 case 'ANNOTATION_REMOVE':
371 return mapValues(state, annotationsForBlock => {
372 return filterWithReference(annotationsForBlock, annotation => {
373 return annotation.id !== action.annotationId;
374 });
375 });
376 case 'ANNOTATION_UPDATE_RANGE':
377 return mapValues(state, annotationsForBlock => {
378 let hasChangedRange = false;
379 const newAnnotations = annotationsForBlock.map(annotation => {
380 if (annotation.id === action.annotationId) {
381 hasChangedRange = true;
382 return {
383 ...annotation,
384 range: {
385 start: action.start,
386 end: action.end
387 }
388 };
389 }
390 return annotation;
391 });
392 return hasChangedRange ? newAnnotations : annotationsForBlock;
393 });
394 case 'ANNOTATION_REMOVE_SOURCE':
395 return mapValues(state, annotationsForBlock => {
396 return filterWithReference(annotationsForBlock, annotation => {
397 return annotation.source !== action.source;
398 });
399 });
400 }
401 return state;
402 }
403 /* harmony default export */ const reducer = (annotations);
404
405 ;// CONCATENATED MODULE: ./packages/annotations/build-module/store/selectors.js
406 /**
407 * WordPress dependencies
408 */
409
410
411 /**
412 * Shared reference to an empty array for cases where it is important to avoid
413 * returning a new array reference on every invocation, as in a connected or
414 * other pure component which performs `shouldComponentUpdate` check on props.
415 * This should be used as a last resort, since the normalized data should be
416 * maintained by the reducer result in state.
417 *
418 * @type {Array}
419 */
420 const EMPTY_ARRAY = [];
421
422 /**
423 * Returns the annotations for a specific client ID.
424 *
425 * @param {Object} state Editor state.
426 * @param {string} clientId The ID of the block to get the annotations for.
427 *
428 * @return {Array} The annotations applicable to this block.
429 */
430 const __experimentalGetAnnotationsForBlock = (0,external_wp_data_namespaceObject.createSelector)((state, blockClientId) => {
431 var _state$blockClientId;
432 return ((_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(annotation => {
433 return annotation.selector === 'block';
434 });
435 }, (state, blockClientId) => {
436 var _state$blockClientId2;
437 return [(_state$blockClientId2 = state?.[blockClientId]) !== null && _state$blockClientId2 !== void 0 ? _state$blockClientId2 : EMPTY_ARRAY];
438 });
439 function __experimentalGetAllAnnotationsForBlock(state, blockClientId) {
440 var _state$blockClientId3;
441 return (_state$blockClientId3 = state?.[blockClientId]) !== null && _state$blockClientId3 !== void 0 ? _state$blockClientId3 : EMPTY_ARRAY;
442 }
443
444 /**
445 * Returns the annotations that apply to the given RichText instance.
446 *
447 * Both a blockClientId and a richTextIdentifier are required. This is because
448 * a block might have multiple `RichText` components. This does mean that every
449 * block needs to implement annotations itself.
450 *
451 * @param {Object} state Editor state.
452 * @param {string} blockClientId The client ID for the block.
453 * @param {string} richTextIdentifier Unique identifier that identifies the given RichText.
454 * @return {Array} All the annotations relevant for the `RichText`.
455 */
456 const __experimentalGetAnnotationsForRichText = (0,external_wp_data_namespaceObject.createSelector)((state, blockClientId, richTextIdentifier) => {
457 var _state$blockClientId4;
458 return ((_state$blockClientId4 = state?.[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(annotation => {
459 return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier;
460 }).map(annotation => {
461 const {
462 range,
463 ...other
464 } = annotation;
465 return {
466 ...range,
467 ...other
468 };
469 });
470 }, (state, blockClientId) => {
471 var _state$blockClientId5;
472 return [(_state$blockClientId5 = state?.[blockClientId]) !== null && _state$blockClientId5 !== void 0 ? _state$blockClientId5 : EMPTY_ARRAY];
473 });
474
475 /**
476 * Returns all annotations in the editor state.
477 *
478 * @param {Object} state Editor state.
479 * @return {Array} All annotations currently applied.
480 */
481 function __experimentalGetAnnotations(state) {
482 return Object.values(state).flat();
483 }
484
485 ;// CONCATENATED MODULE: ./packages/annotations/node_modules/uuid/dist/esm-browser/rng.js
486 // Unique ID creation requires a high quality random # generator. In the browser we therefore
487 // require the crypto API and do not support built-in fallback to lower quality random number
488 // generators (like Math.random()).
489 var getRandomValues;
490 var rnds8 = new Uint8Array(16);
491 function rng() {
492 // lazy load so that environments that need to polyfill have a chance to do so
493 if (!getRandomValues) {
494 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
495 // find the complete implementation of crypto (msCrypto) on IE11.
496 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
497
498 if (!getRandomValues) {
499 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
500 }
501 }
502
503 return getRandomValues(rnds8);
504 }
505 ;// CONCATENATED MODULE: ./packages/annotations/node_modules/uuid/dist/esm-browser/regex.js
506 /* harmony default export */ const regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
507 ;// CONCATENATED MODULE: ./packages/annotations/node_modules/uuid/dist/esm-browser/validate.js
508
509
510 function validate(uuid) {
511 return typeof uuid === 'string' && regex.test(uuid);
512 }
513
514 /* harmony default export */ const esm_browser_validate = (validate);
515 ;// CONCATENATED MODULE: ./packages/annotations/node_modules/uuid/dist/esm-browser/stringify.js
516
517 /**
518 * Convert array of 16 byte values to UUID string format of the form:
519 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
520 */
521
522 var byteToHex = [];
523
524 for (var i = 0; i < 256; ++i) {
525 byteToHex.push((i + 0x100).toString(16).substr(1));
526 }
527
528 function stringify(arr) {
529 var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
530 // Note: Be careful editing this code! It's been tuned for performance
531 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
532 var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
533 // of the following:
534 // - One or more input array values don't map to a hex octet (leading to
535 // "undefined" in the uuid)
536 // - Invalid input values for the RFC `version` or `variant` fields
537
538 if (!esm_browser_validate(uuid)) {
539 throw TypeError('Stringified UUID is invalid');
540 }
541
542 return uuid;
543 }
544
545 /* harmony default export */ const esm_browser_stringify = (stringify);
546 ;// CONCATENATED MODULE: ./packages/annotations/node_modules/uuid/dist/esm-browser/v4.js
547
548
549
550 function v4(options, buf, offset) {
551 options = options || {};
552 var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
553
554 rnds[6] = rnds[6] & 0x0f | 0x40;
555 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
556
557 if (buf) {
558 offset = offset || 0;
559
560 for (var i = 0; i < 16; ++i) {
561 buf[offset + i] = rnds[i];
562 }
563
564 return buf;
565 }
566
567 return esm_browser_stringify(rnds);
568 }
569
570 /* harmony default export */ const esm_browser_v4 = (v4);
571 ;// CONCATENATED MODULE: ./packages/annotations/build-module/store/actions.js
572 /**
573 * External dependencies
574 */
575
576
577 /**
578 * @typedef WPAnnotationRange
579 *
580 * @property {number} start The offset where the annotation should start.
581 * @property {number} end The offset where the annotation should end.
582 */
583
584 /**
585 * Adds an annotation to a block.
586 *
587 * The `block` attribute refers to a block ID that needs to be annotated.
588 * `isBlockAnnotation` controls whether or not the annotation is a block
589 * annotation. The `source` is the source of the annotation, this will be used
590 * to identity groups of annotations.
591 *
592 * The `range` property is only relevant if the selector is 'range'.
593 *
594 * @param {Object} annotation The annotation to add.
595 * @param {string} annotation.blockClientId The blockClientId to add the annotation to.
596 * @param {string} annotation.richTextIdentifier Identifier for the RichText instance the annotation applies to.
597 * @param {WPAnnotationRange} annotation.range The range at which to apply this annotation.
598 * @param {string} [annotation.selector="range"] The way to apply this annotation.
599 * @param {string} [annotation.source="default"] The source that added the annotation.
600 * @param {string} [annotation.id] The ID the annotation should have. Generates a UUID by default.
601 *
602 * @return {Object} Action object.
603 */
604 function __experimentalAddAnnotation({
605 blockClientId,
606 richTextIdentifier = null,
607 range = null,
608 selector = 'range',
609 source = 'default',
610 id = esm_browser_v4()
611 }) {
612 const action = {
613 type: 'ANNOTATION_ADD',
614 id,
615 blockClientId,
616 richTextIdentifier,
617 source,
618 selector
619 };
620 if (selector === 'range') {
621 action.range = range;
622 }
623 return action;
624 }
625
626 /**
627 * Removes an annotation with a specific ID.
628 *
629 * @param {string} annotationId The annotation to remove.
630 *
631 * @return {Object} Action object.
632 */
633 function __experimentalRemoveAnnotation(annotationId) {
634 return {
635 type: 'ANNOTATION_REMOVE',
636 annotationId
637 };
638 }
639
640 /**
641 * Updates the range of an annotation.
642 *
643 * @param {string} annotationId ID of the annotation to update.
644 * @param {number} start The start of the new range.
645 * @param {number} end The end of the new range.
646 *
647 * @return {Object} Action object.
648 */
649 function __experimentalUpdateAnnotationRange(annotationId, start, end) {
650 return {
651 type: 'ANNOTATION_UPDATE_RANGE',
652 annotationId,
653 start,
654 end
655 };
656 }
657
658 /**
659 * Removes all annotations of a specific source.
660 *
661 * @param {string} source The source to remove.
662 *
663 * @return {Object} Action object.
664 */
665 function __experimentalRemoveAnnotationsBySource(source) {
666 return {
667 type: 'ANNOTATION_REMOVE_SOURCE',
668 source
669 };
670 }
671
672 ;// CONCATENATED MODULE: ./packages/annotations/build-module/store/index.js
673 /**
674 * WordPress dependencies
675 */
676
677
678 /**
679 * Internal dependencies
680 */
681
682
683
684
685 /**
686 * Module Constants
687 */
688
689
690 /**
691 * Store definition for the annotations namespace.
692 *
693 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
694 *
695 * @type {Object}
696 */
697 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
698 reducer: reducer,
699 selectors: selectors_namespaceObject,
700 actions: actions_namespaceObject
701 });
702 (0,external_wp_data_namespaceObject.register)(store);
703
704 ;// CONCATENATED MODULE: ./packages/annotations/build-module/index.js
705 /**
706 * Internal dependencies
707 */
708
709
710
711
712 (window.wp = window.wp || {}).annotations = __webpack_exports__;
713 /******/ })()
714 ;