@atlaskit/editor-plugin-decorations 0.1.0 → 0.1.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 CHANGED
@@ -1 +1,14 @@
1
1
  # @atlaskit/editor-plugin-decorations
2
+
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4e6f1bf8511`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4e6f1bf8511) - [ED-19233] Import prosemirror libraries from internal facade package
8
+
9
+ ## 0.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`73b5128036b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/73b5128036b) - [ED-17082] Mark package as a singleton one
14
+ - Updated dependencies
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.removeDecoration = exports.hoverDecoration = exports.default = exports.decorationStateKey = exports.ACTIONS = void 0;
7
- var _prosemirrorState = require("prosemirror-state");
8
- var _prosemirrorUtils = require("prosemirror-utils");
9
- var _prosemirrorView = require("prosemirror-view");
10
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
- var decorationStateKey = new _prosemirrorState.PluginKey('decorationPlugin');
8
+ var _state = require("@atlaskit/editor-prosemirror/state");
9
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
10
+ var _view = require("@atlaskit/editor-prosemirror/view");
11
+ var decorationStateKey = new _state.PluginKey('decorationPlugin');
12
12
  exports.decorationStateKey = decorationStateKey;
13
13
  var ACTIONS = /*#__PURE__*/function (ACTIONS) {
14
14
  ACTIONS[ACTIONS["DECORATION_ADD"] = 0] = "DECORATION_ADD";
@@ -32,7 +32,7 @@ var hoverDecoration = function hoverDecoration(nodeType, add) {
32
32
  return function (state, dispatch) {
33
33
  var from;
34
34
  var parentNode;
35
- if (state.selection instanceof _prosemirrorState.NodeSelection) {
35
+ if (state.selection instanceof _state.NodeSelection) {
36
36
  var selectedNode = state.selection.node;
37
37
  var nodeTypes = Array.isArray(nodeType) ? nodeType : [nodeType];
38
38
  var isNodeTypeMatching = nodeTypes.indexOf(selectedNode.type) > -1;
@@ -49,7 +49,7 @@ var hoverDecoration = function hoverDecoration(nodeType, add) {
49
49
  // the selected node is a child of the one that requires the decoration to
50
50
  // be added, e.g. if a decision item is selected inside a layout and the
51
51
  // user hovers over the layout's delete button.
52
- var foundParentNode = (0, _prosemirrorUtils.findParentNodeOfType)(nodeType)(state.selection);
52
+ var foundParentNode = (0, _utils.findParentNodeOfType)(nodeType)(state.selection);
53
53
  if (from === undefined && foundParentNode) {
54
54
  from = foundParentNode.pos;
55
55
  parentNode = foundParentNode.node;
@@ -62,7 +62,7 @@ var hoverDecoration = function hoverDecoration(nodeType, add) {
62
62
  if (dispatch) {
63
63
  dispatch(state.tr.setMeta(decorationStateKey, {
64
64
  action: add ? ACTIONS.DECORATION_ADD : ACTIONS.DECORATION_REMOVE,
65
- data: _prosemirrorView.Decoration.node(from, from + parentNode.nodeSize, {
65
+ data: _view.Decoration.node(from, from + parentNode.nodeSize, {
66
66
  class: className
67
67
  }, {
68
68
  key: 'decorationNode'
@@ -115,7 +115,7 @@ var _default = function _default() {
115
115
  var _ref = decorationStateKey.getState(state),
116
116
  decoration = _ref.decoration;
117
117
  if (decoration) {
118
- return _prosemirrorView.DecorationSet.create(doc, [decoration]);
118
+ return _view.DecorationSet.create(doc, [decoration]);
119
119
  }
120
120
  return null;
121
121
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-decorations",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,7 @@
1
- import { NodeSelection, PluginKey } from 'prosemirror-state';
2
- import { findParentNodeOfType } from 'prosemirror-utils';
3
- import { Decoration, DecorationSet } from 'prosemirror-view';
4
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
4
+ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
5
  export const decorationStateKey = new PluginKey('decorationPlugin');
6
6
  export let ACTIONS = /*#__PURE__*/function (ACTIONS) {
7
7
  ACTIONS[ACTIONS["DECORATION_ADD"] = 0] = "DECORATION_ADD";
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-decorations",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,7 @@
1
- import { NodeSelection, PluginKey } from 'prosemirror-state';
2
- import { findParentNodeOfType } from 'prosemirror-utils';
3
- import { Decoration, DecorationSet } from 'prosemirror-view';
4
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
4
+ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
5
  export var decorationStateKey = new PluginKey('decorationPlugin');
6
6
  export var ACTIONS = /*#__PURE__*/function (ACTIONS) {
7
7
  ACTIONS[ACTIONS["DECORATION_ADD"] = 0] = "DECORATION_ADD";
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-decorations",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,9 +1,9 @@
1
- import { NodeType } from 'prosemirror-model';
2
- import { PluginKey } from 'prosemirror-state';
3
- import { Decoration } from 'prosemirror-view';
4
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
2
  import type { Command } from '@atlaskit/editor-common/types';
6
- export declare const decorationStateKey: PluginKey<any, any>;
3
+ import { NodeType } from '@atlaskit/editor-prosemirror/model';
4
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
+ export declare const decorationStateKey: PluginKey<any>;
7
7
  export declare enum ACTIONS {
8
8
  DECORATION_ADD = 0,
9
9
  DECORATION_REMOVE = 1
@@ -15,5 +15,5 @@ export type DecorationState = {
15
15
  };
16
16
  type HoverDecorationHandler = typeof hoverDecoration;
17
17
  export type { HoverDecorationHandler };
18
- declare const _default: () => SafePlugin<DecorationState, any>;
18
+ declare const _default: () => SafePlugin<any>;
19
19
  export default _default;
@@ -1,9 +1,9 @@
1
- import { NodeType } from 'prosemirror-model';
2
- import { PluginKey } from 'prosemirror-state';
3
- import { Decoration } from 'prosemirror-view';
4
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
2
  import type { Command } from '@atlaskit/editor-common/types';
6
- export declare const decorationStateKey: PluginKey<any, any>;
3
+ import { NodeType } from '@atlaskit/editor-prosemirror/model';
4
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
5
+ import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
+ export declare const decorationStateKey: PluginKey<any>;
7
7
  export declare enum ACTIONS {
8
8
  DECORATION_ADD = 0,
9
9
  DECORATION_REMOVE = 1
@@ -15,5 +15,5 @@ export type DecorationState = {
15
15
  };
16
16
  type HoverDecorationHandler = typeof hoverDecoration;
17
17
  export type { HoverDecorationHandler };
18
- declare const _default: () => SafePlugin<DecorationState, any>;
18
+ declare const _default: () => SafePlugin<any>;
19
19
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-decorations",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Decorations plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -9,7 +9,8 @@
9
9
  },
10
10
  "atlassian": {
11
11
  "team": "Editor",
12
- "releaseModel": "scheduled"
12
+ "singleton": true,
13
+ "releaseModel": "continuous"
13
14
  },
14
15
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
15
16
  "main": "dist/cjs/index.js",
@@ -22,23 +23,15 @@
22
23
  ".": "./src/index.ts"
23
24
  },
24
25
  "dependencies": {
25
- "@atlaskit/editor-common": "^74.3.0",
26
- "@babel/runtime": "^7.0.0",
27
- "prosemirror-model": "1.16.0",
28
- "prosemirror-state": "1.3.4",
29
- "prosemirror-utils": "^1.0.0-0",
30
- "prosemirror-view": "1.23.7"
26
+ "@atlaskit/editor-common": "^74.29.0",
27
+ "@atlaskit/editor-prosemirror": "1.0.2",
28
+ "@babel/runtime": "^7.0.0"
31
29
  },
32
30
  "peerDependencies": {
33
31
  "react": "^16.8.0"
34
32
  },
35
33
  "devDependencies": {
36
- "@atlaskit/docs": "*",
37
- "@atlaskit/editor-core": "^185.0.0",
38
- "@atlaskit/editor-test-helpers": "^18.2.0",
39
- "@atlaskit/ssr": "*",
40
- "@atlaskit/visual-regression": "*",
41
- "@atlaskit/webdriver-runner": "*",
34
+ "@atlaskit/editor-test-helpers": "^18.10.0",
42
35
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
43
36
  "@testing-library/react": "^12.1.5",
44
37
  "react-dom": "^16.8.0",
package/report.api.md CHANGED
@@ -16,9 +16,9 @@
16
16
 
17
17
  ```ts
18
18
  import type { Command } from '@atlaskit/editor-common/types';
19
- import { Decoration } from 'prosemirror-view';
19
+ import { Decoration } from '@atlaskit/editor-prosemirror/view';
20
20
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
21
- import { NodeType } from 'prosemirror-model';
21
+ import { NodeType } from '@atlaskit/editor-prosemirror/model';
22
22
 
23
23
  // @public (undocumented)
24
24
  export const decorationsPlugin: NextEditorPlugin<
@@ -0,0 +1,37 @@
1
+ ## API Report File for "@atlaskit/editor-plugin-decorations"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import type { Command } from '@atlaskit/editor-common/types';
8
+ import { Decoration } from '@atlaskit/editor-prosemirror/view';
9
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
10
+ import { NodeType } from '@atlaskit/editor-prosemirror/model';
11
+
12
+ // @public (undocumented)
13
+ export const decorationsPlugin: NextEditorPlugin<'decorations', {
14
+ sharedState: DecorationState;
15
+ actions: {
16
+ hoverDecoration: HoverDecorationHandler;
17
+ removeDecoration: typeof removeDecoration;
18
+ };
19
+ }>;
20
+
21
+ // @public (undocumented)
22
+ export type DecorationState = {
23
+ decoration?: Decoration;
24
+ };
25
+
26
+ // @public (undocumented)
27
+ const hoverDecoration: (nodeType: Array<NodeType> | NodeType, add: boolean, className?: string) => Command;
28
+
29
+ // @public (undocumented)
30
+ export type HoverDecorationHandler = typeof hoverDecoration;
31
+
32
+ // @public (undocumented)
33
+ const removeDecoration: Command;
34
+
35
+ // (No @packageDocumentation comment for this package)
36
+
37
+ ```