@atlaskit/editor-plugin-track-changes 0.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/LICENSE.md +11 -0
- package/README.md +1 -0
- package/build/tsconfig.json +17 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/pm-plugins/main.js +29 -0
- package/dist/cjs/trackChangesPlugin.js +24 -0
- package/dist/cjs/trackChangesPluginType.js +5 -0
- package/dist/es2019/index.js +4 -0
- package/dist/es2019/pm-plugins/main.js +23 -0
- package/dist/es2019/trackChangesPlugin.js +17 -0
- package/dist/es2019/trackChangesPluginType.js +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/pm-plugins/main.js +23 -0
- package/dist/esm/trackChangesPlugin.js +18 -0
- package/dist/esm/trackChangesPluginType.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/pm-plugins/main.d.ts +6 -0
- package/dist/types/trackChangesPlugin.d.ts +2 -0
- package/dist/types/trackChangesPluginType.d.ts +2 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +6 -0
- package/dist/types-ts4.5/trackChangesPlugin.d.ts +2 -0
- package/dist/types-ts4.5/trackChangesPluginType.d.ts +2 -0
- package/docs/0-intro.tsx +43 -0
- package/package.json +80 -0
- package/tsconfig.json +12 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2019 Atlassian Pty Ltd
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
|
4
|
+
compliance with the License. You may obtain a copy of the License at
|
|
5
|
+
|
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
|
|
8
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
9
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
10
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
|
11
|
+
License.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Editor plugin track changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es5",
|
|
5
|
+
"paths": {}
|
|
6
|
+
},
|
|
7
|
+
"include": [
|
|
8
|
+
"../src/**/*.ts",
|
|
9
|
+
"../src/**/*.tsx"
|
|
10
|
+
],
|
|
11
|
+
"exclude": [
|
|
12
|
+
"../src/**/__tests__/*",
|
|
13
|
+
"../src/**/*.test.*",
|
|
14
|
+
"../src/**/test.*",
|
|
15
|
+
"../src/**/examples.*"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "trackChangesPlugin", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _trackChangesPlugin.trackChangesPlugin;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _trackChangesPlugin = require("./trackChangesPlugin");
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.trackChangesPluginKey = exports.createTrackChangesPlugin = void 0;
|
|
7
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
+
var trackChangesPluginKey = exports.trackChangesPluginKey = new _state.PluginKey('showDiffPlugin');
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
12
|
+
|
|
13
|
+
var createTrackChangesPlugin = exports.createTrackChangesPlugin = function createTrackChangesPlugin() {
|
|
14
|
+
return new _safePlugin.SafePlugin({
|
|
15
|
+
key: trackChangesPluginKey,
|
|
16
|
+
state: {
|
|
17
|
+
init: function init() {
|
|
18
|
+
return {};
|
|
19
|
+
},
|
|
20
|
+
apply: function apply(tr, currentPluginState) {
|
|
21
|
+
var meta = tr.getMeta(trackChangesPluginKey);
|
|
22
|
+
if (meta) {
|
|
23
|
+
return meta;
|
|
24
|
+
}
|
|
25
|
+
return currentPluginState;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.trackChangesPlugin = void 0;
|
|
7
|
+
var _main = require("./pm-plugins/main");
|
|
8
|
+
var trackChangesPlugin = exports.trackChangesPlugin = function trackChangesPlugin() {
|
|
9
|
+
return {
|
|
10
|
+
name: 'trackChanges',
|
|
11
|
+
pmPlugins: function pmPlugins() {
|
|
12
|
+
return [{
|
|
13
|
+
name: 'trackChangesPlugin',
|
|
14
|
+
plugin: _main.createTrackChangesPlugin
|
|
15
|
+
}];
|
|
16
|
+
},
|
|
17
|
+
commands: {
|
|
18
|
+
setBaseline: function setBaseline(_ref) {
|
|
19
|
+
var tr = _ref.tr;
|
|
20
|
+
return tr.setMeta('setBaseline', true);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export const trackChangesPluginKey = new PluginKey('showDiffPlugin');
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
6
|
+
|
|
7
|
+
export const createTrackChangesPlugin = () => {
|
|
8
|
+
return new SafePlugin({
|
|
9
|
+
key: trackChangesPluginKey,
|
|
10
|
+
state: {
|
|
11
|
+
init() {
|
|
12
|
+
return {};
|
|
13
|
+
},
|
|
14
|
+
apply: (tr, currentPluginState) => {
|
|
15
|
+
const meta = tr.getMeta(trackChangesPluginKey);
|
|
16
|
+
if (meta) {
|
|
17
|
+
return meta;
|
|
18
|
+
}
|
|
19
|
+
return currentPluginState;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createTrackChangesPlugin } from './pm-plugins/main';
|
|
2
|
+
export const trackChangesPlugin = () => ({
|
|
3
|
+
name: 'trackChanges',
|
|
4
|
+
pmPlugins() {
|
|
5
|
+
return [{
|
|
6
|
+
name: 'trackChangesPlugin',
|
|
7
|
+
plugin: createTrackChangesPlugin
|
|
8
|
+
}];
|
|
9
|
+
},
|
|
10
|
+
commands: {
|
|
11
|
+
setBaseline: ({
|
|
12
|
+
tr
|
|
13
|
+
}) => {
|
|
14
|
+
return tr.setMeta('setBaseline', true);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export var trackChangesPluginKey = new PluginKey('showDiffPlugin');
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
6
|
+
|
|
7
|
+
export var createTrackChangesPlugin = function createTrackChangesPlugin() {
|
|
8
|
+
return new SafePlugin({
|
|
9
|
+
key: trackChangesPluginKey,
|
|
10
|
+
state: {
|
|
11
|
+
init: function init() {
|
|
12
|
+
return {};
|
|
13
|
+
},
|
|
14
|
+
apply: function apply(tr, currentPluginState) {
|
|
15
|
+
var meta = tr.getMeta(trackChangesPluginKey);
|
|
16
|
+
if (meta) {
|
|
17
|
+
return meta;
|
|
18
|
+
}
|
|
19
|
+
return currentPluginState;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createTrackChangesPlugin } from './pm-plugins/main';
|
|
2
|
+
export var trackChangesPlugin = function trackChangesPlugin() {
|
|
3
|
+
return {
|
|
4
|
+
name: 'trackChanges',
|
|
5
|
+
pmPlugins: function pmPlugins() {
|
|
6
|
+
return [{
|
|
7
|
+
name: 'trackChangesPlugin',
|
|
8
|
+
plugin: createTrackChangesPlugin
|
|
9
|
+
}];
|
|
10
|
+
},
|
|
11
|
+
commands: {
|
|
12
|
+
setBaseline: function setBaseline(_ref) {
|
|
13
|
+
var tr = _ref.tr;
|
|
14
|
+
return tr.setMeta('setBaseline', true);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const trackChangesPluginKey: PluginKey<any>;
|
|
4
|
+
type TrackChangesPluginState = {};
|
|
5
|
+
export declare const createTrackChangesPlugin: () => SafePlugin<TrackChangesPluginState>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const trackChangesPluginKey: PluginKey<any>;
|
|
4
|
+
type TrackChangesPluginState = {};
|
|
5
|
+
export declare const createTrackChangesPlugin: () => SafePlugin<TrackChangesPluginState>;
|
|
6
|
+
export {};
|
package/docs/0-intro.tsx
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { AtlassianInternalWarning, code, md } from '@atlaskit/docs';
|
|
4
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
5
|
+
import { createEditorUseOnlyNotice } from '@atlaskit/editor-common/doc-utils';
|
|
6
|
+
import { token } from '@atlaskit/tokens';
|
|
7
|
+
|
|
8
|
+
export default md`
|
|
9
|
+
|
|
10
|
+
${createEditorUseOnlyNotice('Editor Plugin Track Changes', [
|
|
11
|
+
{ name: 'Editor Core', link: '/packages/editor/editor-core' },
|
|
12
|
+
])}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
${
|
|
16
|
+
(
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
18
|
+
<div style={{ marginTop: token('space.100', '8px') }}>
|
|
19
|
+
<AtlassianInternalWarning />
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
This package includes the track changes plugin used by \`@atlaskit/editor-core\`.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
The \`dependencies\`, \`configuration\`, \`state\`, \`actions\`, and \`commands\` of the plugin are defined
|
|
30
|
+
below:
|
|
31
|
+
|
|
32
|
+
${code`
|
|
33
|
+
type TrackChangesPlugin = NextEditorPlugin<'trackChanges'>;
|
|
34
|
+
`}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Support
|
|
38
|
+
---
|
|
39
|
+
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.
|
|
40
|
+
## License
|
|
41
|
+
---
|
|
42
|
+
Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
|
|
43
|
+
`;
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-track-changes",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "ShowDiff 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: AI",
|
|
12
|
+
"releaseModel": "continuous",
|
|
13
|
+
"singleton": true
|
|
14
|
+
},
|
|
15
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
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": "^107.7.0",
|
|
35
|
+
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
36
|
+
"@babel/runtime": "^7.0.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": "^18.2.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"typescript": "~5.4.2"
|
|
43
|
+
},
|
|
44
|
+
"techstack": {
|
|
45
|
+
"@atlassian/frontend": {
|
|
46
|
+
"code-structure": [
|
|
47
|
+
"editor-plugin"
|
|
48
|
+
],
|
|
49
|
+
"import-structure": [
|
|
50
|
+
"atlassian-conventions"
|
|
51
|
+
],
|
|
52
|
+
"circular-dependencies": [
|
|
53
|
+
"file-and-folder-level"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"@repo/internal": {
|
|
57
|
+
"dom-events": "use-bind-event-listener",
|
|
58
|
+
"analytics": [
|
|
59
|
+
"analytics-next"
|
|
60
|
+
],
|
|
61
|
+
"design-tokens": [
|
|
62
|
+
"color"
|
|
63
|
+
],
|
|
64
|
+
"theming": [
|
|
65
|
+
"react-context"
|
|
66
|
+
],
|
|
67
|
+
"ui-components": [
|
|
68
|
+
"lite-mode"
|
|
69
|
+
],
|
|
70
|
+
"deprecation": "no-deprecated-imports",
|
|
71
|
+
"styling": [
|
|
72
|
+
"emotion",
|
|
73
|
+
"emotion"
|
|
74
|
+
],
|
|
75
|
+
"imports": [
|
|
76
|
+
"import-no-extraneous-disable-for-examples-and-docs"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
package/tsconfig.json
ADDED