@atlaskit/editor-plugin-block-controls 1.0.0

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/.eslintrc.js ADDED
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ rules: {
3
+ '@typescript-eslint/no-duplicate-imports': 'error',
4
+ '@typescript-eslint/no-explicit-any': 'error',
5
+ },
6
+ overrides: [
7
+ {
8
+ files: ['**/__tests__/**/*.{js,ts,tsx}', '**/examples/**/*.{js,ts,tsx}'],
9
+ rules: {
10
+ '@typescript-eslint/no-explicit-any': 'off',
11
+ },
12
+ },
13
+ ],
14
+ };
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @atlaskit/editor-plugin-block-controls
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#91350](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91350) [`f27c4b41ebed`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f27c4b41ebed) - Adds new Editor Block Controls plugin
package/LICENSE.md ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023 Atlassian Pty Ltd
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Editor plugin block controls
2
+
3
+ Block controls plugin for @atlaskit/editor-core
4
+
5
+ **Note:** This component is designed for internal Atlassian development.
6
+ External contributors will be able to use this component but will not be able to submit issues.
7
+
8
+ ## Install
9
+
10
+ ---
11
+
12
+ - **Install** - _yarn add @atlaskit/editor-plugin-block-controls_
13
+ - **npm** - [@atlaskit/editor-plugin-block-controls](https://www.npmjs.com/package/@atlaskit/editor-plugin-block-controls)
14
+ - **Source** - [Bitbucket](https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/editor/editor-plugin-block-controls)
15
+ - **Bundle** - [unpkg.com](https://unpkg.com/@atlaskit/editor-plugin-block-controls/dist/)
16
+
17
+ ## Usage
18
+
19
+ ---
20
+
21
+ **Internal use only**
22
+
23
+ @atlaskit/editor-plugin-block-controls is intended for internal use by the @atlaskit/editor-core and as a plugin dependency of the Editor within your product.
24
+
25
+ Direct use of this component is not supported.
26
+
27
+ Please see [Atlaskit - Editor plugin block controls](https://atlaskit.atlassian.com/packages/editor/editor-plugin-block-controls) for documentation and examples for this package.
28
+
29
+ ## Support
30
+
31
+ ---
32
+
33
+ For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
34
+
35
+ ## License
36
+
37
+ ---
38
+
39
+ Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "blockControlsPlugin", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _plugin.blockControlsPlugin;
10
+ }
11
+ });
12
+ var _plugin = require("./plugin");
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.blockControlsPlugin = void 0;
7
+ var _main = require("./pm-plugins/main");
8
+ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPlugin(_ref) {
9
+ var api = _ref.api;
10
+ return {
11
+ name: 'blockControls',
12
+ pmPlugins: function pmPlugins() {
13
+ return [{
14
+ name: 'blockControlsPmPlugin',
15
+ plugin: function plugin() {
16
+ return (0, _main.createPlugin)(api);
17
+ }
18
+ }];
19
+ },
20
+ getSharedState: function getSharedState(_editorState) {
21
+ return undefined;
22
+ }
23
+ };
24
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.key = exports.createPlugin = void 0;
7
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
+ var _state = require("@atlaskit/editor-prosemirror/state");
9
+ var _view = require("@atlaskit/editor-prosemirror/view");
10
+ var key = exports.key = new _state.PluginKey('blockControls');
11
+ var createPlugin = exports.createPlugin = function createPlugin(api) {
12
+ return new _safePlugin.SafePlugin({
13
+ key: key,
14
+ state: {
15
+ init: function init() {
16
+ return {
17
+ decorations: _view.DecorationSet.empty
18
+ };
19
+ },
20
+ apply: function apply(tr, currentState) {
21
+ var decorations = currentState.decorations;
22
+ return {
23
+ decorations: decorations
24
+ };
25
+ }
26
+ },
27
+ props: {
28
+ decorations: function decorations(state) {
29
+ var _key$getState;
30
+ return (_key$getState = key.getState(state)) === null || _key$getState === void 0 ? void 0 : _key$getState.decorations;
31
+ }
32
+ }
33
+ });
34
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1 @@
1
+ export { blockControlsPlugin } from './plugin';
@@ -0,0 +1,15 @@
1
+ import { createPlugin } from './pm-plugins/main';
2
+ export const blockControlsPlugin = ({
3
+ api
4
+ }) => ({
5
+ name: 'blockControls',
6
+ pmPlugins() {
7
+ return [{
8
+ name: 'blockControlsPmPlugin',
9
+ plugin: () => createPlugin(api)
10
+ }];
11
+ },
12
+ getSharedState(_editorState) {
13
+ return undefined;
14
+ }
15
+ });
@@ -0,0 +1,30 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
+ export const key = new PluginKey('blockControls');
5
+ export const createPlugin = api => {
6
+ return new SafePlugin({
7
+ key,
8
+ state: {
9
+ init() {
10
+ return {
11
+ decorations: DecorationSet.empty
12
+ };
13
+ },
14
+ apply(tr, currentState) {
15
+ const {
16
+ decorations
17
+ } = currentState;
18
+ return {
19
+ decorations
20
+ };
21
+ }
22
+ },
23
+ props: {
24
+ decorations: state => {
25
+ var _key$getState;
26
+ return (_key$getState = key.getState(state)) === null || _key$getState === void 0 ? void 0 : _key$getState.decorations;
27
+ }
28
+ }
29
+ });
30
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { blockControlsPlugin } from './plugin';
@@ -0,0 +1,18 @@
1
+ import { createPlugin } from './pm-plugins/main';
2
+ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
3
+ var api = _ref.api;
4
+ return {
5
+ name: 'blockControls',
6
+ pmPlugins: function pmPlugins() {
7
+ return [{
8
+ name: 'blockControlsPmPlugin',
9
+ plugin: function plugin() {
10
+ return createPlugin(api);
11
+ }
12
+ }];
13
+ },
14
+ getSharedState: function getSharedState(_editorState) {
15
+ return undefined;
16
+ }
17
+ };
18
+ };
@@ -0,0 +1,28 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
+ export var key = new PluginKey('blockControls');
5
+ export var createPlugin = function createPlugin(api) {
6
+ return new SafePlugin({
7
+ key: key,
8
+ state: {
9
+ init: function init() {
10
+ return {
11
+ decorations: DecorationSet.empty
12
+ };
13
+ },
14
+ apply: function apply(tr, currentState) {
15
+ var decorations = currentState.decorations;
16
+ return {
17
+ decorations: decorations
18
+ };
19
+ }
20
+ },
21
+ props: {
22
+ decorations: function decorations(state) {
23
+ var _key$getState;
24
+ return (_key$getState = key.getState(state)) === null || _key$getState === void 0 ? void 0 : _key$getState.decorations;
25
+ }
26
+ }
27
+ });
28
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { blockControlsPlugin } from './plugin';
2
+ export type { BlockControlsPlugin } from './types';
@@ -0,0 +1,2 @@
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
+ export declare const blockControlsPlugin: NextEditorPlugin<'blockControls'>;
@@ -0,0 +1,13 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
+ import type { BlockControlsPlugin } from '../types';
6
+ export declare const key: PluginKey<PluginState>;
7
+ export interface PluginState {
8
+ decorations: DecorationSet;
9
+ isDragging: boolean;
10
+ }
11
+ export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined) => SafePlugin<{
12
+ decorations: DecorationSet;
13
+ }>;
@@ -0,0 +1,7 @@
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
+ export type ReleaseHiddenDecoration = () => boolean | undefined;
3
+ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
4
+ dependencies: [];
5
+ sharedState: undefined;
6
+ actions: {};
7
+ }>;
@@ -0,0 +1,2 @@
1
+ export { blockControlsPlugin } from './plugin';
2
+ export type { BlockControlsPlugin } from './types';
@@ -0,0 +1,2 @@
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
+ export declare const blockControlsPlugin: NextEditorPlugin<'blockControls'>;
@@ -0,0 +1,13 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
+ import type { BlockControlsPlugin } from '../types';
6
+ export declare const key: PluginKey<PluginState>;
7
+ export interface PluginState {
8
+ decorations: DecorationSet;
9
+ isDragging: boolean;
10
+ }
11
+ export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined) => SafePlugin<{
12
+ decorations: DecorationSet;
13
+ }>;
@@ -0,0 +1,8 @@
1
+ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
+ export type ReleaseHiddenDecoration = () => boolean | undefined;
3
+ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
4
+ dependencies: [
5
+ ];
6
+ sharedState: undefined;
7
+ actions: {};
8
+ }>;
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@atlaskit/editor-plugin-block-controls",
3
+ "version": "1.0.0",
4
+ "description": "Block controls plugin for @atlaskit/editor-core",
5
+ "author": "Atlassian Pty Ltd",
6
+ "license": "Apache-2.0",
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org/"
9
+ },
10
+ "atlassian": {
11
+ "team": "Editor: Jenga",
12
+ "inPublicMirror": false,
13
+ "releaseModel": "continuous"
14
+ },
15
+ "repository": "https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo",
16
+ "main": "dist/cjs/index.js",
17
+ "module": "dist/esm/index.js",
18
+ "module:es2019": "dist/es2019/index.js",
19
+ "types": "dist/types/index.d.ts",
20
+ "typesVersions": {
21
+ ">=4.5 <4.9": {
22
+ "*": [
23
+ "dist/types-ts4.5/*",
24
+ "dist/types-ts4.5/index.d.ts"
25
+ ]
26
+ }
27
+ },
28
+ "sideEffects": false,
29
+ "atlaskit:src": "src/index.ts",
30
+ "af:exports": {
31
+ ".": "./src/index.ts"
32
+ },
33
+ "dependencies": {
34
+ "@atlaskit/editor-common": "^78.29.0",
35
+ "@atlaskit/editor-prosemirror": "3.0.0",
36
+ "@babel/runtime": "^7.0.0"
37
+ },
38
+ "peerDependencies": {
39
+ "react": "^16.8.0"
40
+ },
41
+ "devDependencies": {
42
+ "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0"
43
+ },
44
+ "techstack": {
45
+ "@atlassian/frontend": {
46
+ "import-structure": [
47
+ "atlassian-conventions"
48
+ ],
49
+ "circular-dependencies": [
50
+ "file-and-folder-level"
51
+ ]
52
+ },
53
+ "@repo/internal": {
54
+ "dom-events": "use-bind-event-listener",
55
+ "analytics": [
56
+ "analytics-next"
57
+ ],
58
+ "design-tokens": [
59
+ "color"
60
+ ],
61
+ "theming": [
62
+ "react-context"
63
+ ],
64
+ "ui-components": [
65
+ "lite-mode"
66
+ ],
67
+ "deprecation": [
68
+ "no-deprecated-imports"
69
+ ],
70
+ "styling": [
71
+ "emotion",
72
+ "compiled"
73
+ ],
74
+ "imports": [
75
+ "import-no-extraneous-disable-for-examples-and-docs"
76
+ ]
77
+ }
78
+ },
79
+ "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
80
+ }