@atlaskit/editor-plugin-highlight 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 +6 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE.md +13 -0
- package/README.md +9 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/plugin.js +40 -0
- package/dist/cjs/pm-plugin.js +15 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/plugin.js +32 -0
- package/dist/es2019/pm-plugin.js +10 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/plugin.js +35 -0
- package/dist/esm/pm-plugin.js +9 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/plugin.d.ts +12 -0
- package/dist/types/pm-plugin.d.ts +10 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/plugin.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugin.d.ts +10 -0
- package/package.json +95 -0
package/.eslintrc.js
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @atlaskit/editor-plugin-highlight
|
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,9 @@
|
|
|
1
|
+
# EditorPluginHighlight
|
|
2
|
+
|
|
3
|
+
Highlight plugin for @atlaskit/editor-core
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
`import EditorPluginHighlight from '@atlaskit/editor-plugins/highlight';`
|
|
8
|
+
|
|
9
|
+
Detailed docs and example usage can be found [here](https://atlaskit.atlassian.com/packages/editor/editor-plugin-highlight).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "highlightPlugin", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _plugin.highlightPlugin;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _plugin = require("./plugin");
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.highlightPlugin = void 0;
|
|
7
|
+
var _pmPlugin = require("./pm-plugin");
|
|
8
|
+
// TODO: Uncomment once ADF schema change rolled out in AFM
|
|
9
|
+
// import { backgroundColor } from '@atlaskit/adf-schema';
|
|
10
|
+
|
|
11
|
+
var highlightPlugin = exports.highlightPlugin = function highlightPlugin(_ref) {
|
|
12
|
+
var api = _ref.api;
|
|
13
|
+
return {
|
|
14
|
+
name: 'highlight',
|
|
15
|
+
// TODO: Uncomment once ADF schema change rolled out in AFM
|
|
16
|
+
// marks() {
|
|
17
|
+
// return [{ name: 'backgroundColor', mark: backgroundColor }];
|
|
18
|
+
// },
|
|
19
|
+
|
|
20
|
+
pmPlugins: function pmPlugins() {
|
|
21
|
+
return [{
|
|
22
|
+
name: 'highlight',
|
|
23
|
+
plugin: function plugin() {
|
|
24
|
+
return (0, _pmPlugin.createPlugin)({
|
|
25
|
+
api: api
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}];
|
|
29
|
+
},
|
|
30
|
+
getSharedState: function getSharedState(editorState) {
|
|
31
|
+
if (!editorState) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
return _pmPlugin.highlightPluginKey.getState(editorState);
|
|
35
|
+
} // Add highlight toolbar button to primary toolbar
|
|
36
|
+
// primaryToolbarComponent({ disabled }) {
|
|
37
|
+
// TODO: Implement primary toolbar UI
|
|
38
|
+
// },
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.highlightPluginKey = exports.createPlugin = void 0;
|
|
7
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
+
var highlightPluginKey = exports.highlightPluginKey = new _state.PluginKey('highlight');
|
|
10
|
+
var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
11
|
+
var api = _ref.api;
|
|
12
|
+
return new _safePlugin.SafePlugin({
|
|
13
|
+
key: highlightPluginKey
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { highlightPlugin } from './plugin';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createPlugin, highlightPluginKey } from './pm-plugin';
|
|
2
|
+
|
|
3
|
+
// TODO: Uncomment once ADF schema change rolled out in AFM
|
|
4
|
+
// import { backgroundColor } from '@atlaskit/adf-schema';
|
|
5
|
+
|
|
6
|
+
export const highlightPlugin = ({
|
|
7
|
+
api
|
|
8
|
+
}) => ({
|
|
9
|
+
name: 'highlight',
|
|
10
|
+
// TODO: Uncomment once ADF schema change rolled out in AFM
|
|
11
|
+
// marks() {
|
|
12
|
+
// return [{ name: 'backgroundColor', mark: backgroundColor }];
|
|
13
|
+
// },
|
|
14
|
+
|
|
15
|
+
pmPlugins: () => [{
|
|
16
|
+
name: 'highlight',
|
|
17
|
+
plugin: () => createPlugin({
|
|
18
|
+
api
|
|
19
|
+
})
|
|
20
|
+
}],
|
|
21
|
+
getSharedState(editorState) {
|
|
22
|
+
if (!editorState) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
return highlightPluginKey.getState(editorState);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Add highlight toolbar button to primary toolbar
|
|
29
|
+
// primaryToolbarComponent({ disabled }) {
|
|
30
|
+
// TODO: Implement primary toolbar UI
|
|
31
|
+
// },
|
|
32
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export const highlightPluginKey = new PluginKey('highlight');
|
|
4
|
+
export const createPlugin = ({
|
|
5
|
+
api
|
|
6
|
+
}) => {
|
|
7
|
+
return new SafePlugin({
|
|
8
|
+
key: highlightPluginKey
|
|
9
|
+
});
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { highlightPlugin } from './plugin';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createPlugin, highlightPluginKey } from './pm-plugin';
|
|
2
|
+
|
|
3
|
+
// TODO: Uncomment once ADF schema change rolled out in AFM
|
|
4
|
+
// import { backgroundColor } from '@atlaskit/adf-schema';
|
|
5
|
+
|
|
6
|
+
export var highlightPlugin = function highlightPlugin(_ref) {
|
|
7
|
+
var api = _ref.api;
|
|
8
|
+
return {
|
|
9
|
+
name: 'highlight',
|
|
10
|
+
// TODO: Uncomment once ADF schema change rolled out in AFM
|
|
11
|
+
// marks() {
|
|
12
|
+
// return [{ name: 'backgroundColor', mark: backgroundColor }];
|
|
13
|
+
// },
|
|
14
|
+
|
|
15
|
+
pmPlugins: function pmPlugins() {
|
|
16
|
+
return [{
|
|
17
|
+
name: 'highlight',
|
|
18
|
+
plugin: function plugin() {
|
|
19
|
+
return createPlugin({
|
|
20
|
+
api: api
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}];
|
|
24
|
+
},
|
|
25
|
+
getSharedState: function getSharedState(editorState) {
|
|
26
|
+
if (!editorState) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
return highlightPluginKey.getState(editorState);
|
|
30
|
+
} // Add highlight toolbar button to primary toolbar
|
|
31
|
+
// primaryToolbarComponent({ disabled }) {
|
|
32
|
+
// TODO: Implement primary toolbar UI
|
|
33
|
+
// },
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export var highlightPluginKey = new PluginKey('highlight');
|
|
4
|
+
export var createPlugin = function createPlugin(_ref) {
|
|
5
|
+
var api = _ref.api;
|
|
6
|
+
return new SafePlugin({
|
|
7
|
+
key: highlightPluginKey
|
|
8
|
+
});
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { TextFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
|
|
4
|
+
import type { HighlightPluginState } from './pm-plugin';
|
|
5
|
+
export type HighlightPlugin = NextEditorPlugin<'highlight', {
|
|
6
|
+
dependencies: [
|
|
7
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
8
|
+
OptionalPlugin<TextFormattingPlugin>
|
|
9
|
+
];
|
|
10
|
+
sharedState: HighlightPluginState | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const highlightPlugin: HighlightPlugin;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 type { HighlightPlugin } from './plugin';
|
|
5
|
+
export interface HighlightPluginState {
|
|
6
|
+
}
|
|
7
|
+
export declare const highlightPluginKey: PluginKey<HighlightPluginState>;
|
|
8
|
+
export declare const createPlugin: ({ api, }: {
|
|
9
|
+
api: ExtractInjectionAPI<HighlightPlugin> | undefined;
|
|
10
|
+
}) => SafePlugin<any>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { TextFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
|
|
4
|
+
import type { HighlightPluginState } from './pm-plugin';
|
|
5
|
+
export type HighlightPlugin = NextEditorPlugin<'highlight', {
|
|
6
|
+
dependencies: [
|
|
7
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
8
|
+
OptionalPlugin<TextFormattingPlugin>
|
|
9
|
+
];
|
|
10
|
+
sharedState: HighlightPluginState | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const highlightPlugin: HighlightPlugin;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 type { HighlightPlugin } from './plugin';
|
|
5
|
+
export interface HighlightPluginState {
|
|
6
|
+
}
|
|
7
|
+
export declare const highlightPluginKey: PluginKey<HighlightPluginState>;
|
|
8
|
+
export declare const createPlugin: ({ api, }: {
|
|
9
|
+
api: ExtractInjectionAPI<HighlightPlugin> | undefined;
|
|
10
|
+
}) => SafePlugin<any>;
|
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-highlight",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Highlight 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: Core Experiences",
|
|
12
|
+
"inPublicMirror": false,
|
|
13
|
+
"releaseModel": "continuous",
|
|
14
|
+
"website": {
|
|
15
|
+
"name": "EditorPluginHighlight",
|
|
16
|
+
"category": "Components"
|
|
17
|
+
},
|
|
18
|
+
"runReact18": false
|
|
19
|
+
},
|
|
20
|
+
"repository": "https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo",
|
|
21
|
+
"main": "dist/cjs/index.js",
|
|
22
|
+
"module": "dist/esm/index.js",
|
|
23
|
+
"module:es2019": "dist/es2019/index.js",
|
|
24
|
+
"types": "dist/types/index.d.ts",
|
|
25
|
+
"typesVersions": {
|
|
26
|
+
">=4.5 <5.4": {
|
|
27
|
+
"*": [
|
|
28
|
+
"dist/types-ts4.5/*",
|
|
29
|
+
"dist/types-ts4.5/index.d.ts"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"sideEffects": [
|
|
34
|
+
"*.compiled.css"
|
|
35
|
+
],
|
|
36
|
+
"atlaskit:src": "src/index.ts",
|
|
37
|
+
"af:exports": {
|
|
38
|
+
".": "./src/index.ts"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@atlaskit/editor-common": "^78.32.0",
|
|
42
|
+
"@atlaskit/editor-plugin-analytics": "^1.1.0",
|
|
43
|
+
"@atlaskit/editor-plugin-text-formatting": "^1.4.0",
|
|
44
|
+
"@atlaskit/editor-prosemirror": "4.0.0",
|
|
45
|
+
"@babel/runtime": "^7.0.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": "^16.8.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
52
|
+
"typescript": "~5.4.2"
|
|
53
|
+
},
|
|
54
|
+
"techstack": {
|
|
55
|
+
"@atlassian/frontend": {
|
|
56
|
+
"import-structure": [
|
|
57
|
+
"atlassian-conventions"
|
|
58
|
+
],
|
|
59
|
+
"circular-dependencies": [
|
|
60
|
+
"file-and-folder-level"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"@repo/internal": {
|
|
64
|
+
"dom-events": "use-bind-event-listener",
|
|
65
|
+
"analytics": [
|
|
66
|
+
"analytics-next"
|
|
67
|
+
],
|
|
68
|
+
"design-tokens": [
|
|
69
|
+
"color"
|
|
70
|
+
],
|
|
71
|
+
"theming": [
|
|
72
|
+
"react-context"
|
|
73
|
+
],
|
|
74
|
+
"ui-components": [
|
|
75
|
+
"lite-mode"
|
|
76
|
+
],
|
|
77
|
+
"deprecation": [
|
|
78
|
+
"no-deprecated-imports"
|
|
79
|
+
],
|
|
80
|
+
"styling": [
|
|
81
|
+
"static",
|
|
82
|
+
"compiled"
|
|
83
|
+
],
|
|
84
|
+
"imports": [
|
|
85
|
+
"import-no-extraneous-disable-for-examples-and-docs"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
90
|
+
"stricter": {
|
|
91
|
+
"no-unused-dependencies": {
|
|
92
|
+
"checkDevDependencies": true
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|