@atlaskit/editor-plugin-user-preferences 0.2.2 → 0.3.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/CHANGELOG.md +12 -0
- package/afm-volt/tsconfig.json +33 -0
- package/dist/cjs/userPreferencesPlugin.js +0 -2
- package/dist/es2019/userPreferencesPlugin.js +0 -2
- package/dist/esm/userPreferencesPlugin.js +0 -2
- package/dist/types/ui/useUserPreferencesInitListener.d.ts +3 -3
- package/dist/types/ui/useUserPreferencesUpdateListener.d.ts +1 -1
- package/dist/types-ts4.5/ui/useUserPreferencesInitListener.d.ts +3 -3
- package/dist/types-ts4.5/ui/useUserPreferencesUpdateListener.d.ts +1 -1
- package/package.json +4 -5
- package/dist/cjs/ui/useDocumentVisibilityWatcher.js +0 -53
- package/dist/es2019/ui/useDocumentVisibilityWatcher.js +0 -24
- package/dist/esm/ui/useDocumentVisibilityWatcher.js +0 -46
- package/dist/types/ui/useDocumentVisibilityWatcher.d.ts +0 -2
- package/dist/types-ts4.5/ui/useDocumentVisibilityWatcher.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-user-preferences
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#177157](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/177157)
|
|
8
|
+
[`6bcf8912217df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6bcf8912217df) -
|
|
9
|
+
ED-27284 additional integration with user preference plugin
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 0.2.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.volt.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es5",
|
|
5
|
+
"outDir": "../../../../../volt/tsDist/@atlaskit__editor-plugin-user-preferences/app",
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"../src/**/*.ts",
|
|
11
|
+
"../src/**/*.tsx"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"../src/**/__tests__/*",
|
|
15
|
+
"../src/**/*.test.*",
|
|
16
|
+
"../src/**/test.*",
|
|
17
|
+
"../src/**/examples.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../editor-common/afm-volt/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../editor-plugin-analytics/afm-volt/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../../platform/feature-flags/afm-volt/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../tmp-editor-statsig/afm-volt/tsconfig.json"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -7,7 +7,6 @@ exports.userPreferencesPlugin = void 0;
|
|
|
7
7
|
var _userPreferences = require("@atlaskit/editor-common/user-preferences");
|
|
8
8
|
var _commands = require("./pm-plugins/commands");
|
|
9
9
|
var _main = require("./pm-plugins/main");
|
|
10
|
-
var _useDocumentVisibilityWatcher = require("./ui/useDocumentVisibilityWatcher");
|
|
11
10
|
var _useUserPreferencesInitListener = require("./ui/useUserPreferencesInitListener");
|
|
12
11
|
var _useUserPreferencesUpdateListener = require("./ui/useUserPreferencesUpdateListener");
|
|
13
12
|
var userPreferencesPlugin = exports.userPreferencesPlugin = function userPreferencesPlugin(_ref) {
|
|
@@ -46,7 +45,6 @@ var userPreferencesPlugin = exports.userPreferencesPlugin = function userPrefere
|
|
|
46
45
|
var _useResolvedUserPrefe = (0, _userPreferences.useResolvedUserPreferences)(userPreferencesProvider),
|
|
47
46
|
resolvedUserPreferences = _useResolvedUserPrefe.resolvedUserPreferences;
|
|
48
47
|
(0, _useUserPreferencesUpdateListener.useUserPreferencesUpdateListener)(editorView, resolvedUserPreferences);
|
|
49
|
-
(0, _useDocumentVisibilityWatcher.useDocumentVisibilityWatcher)(userPreferencesProvider);
|
|
50
48
|
(0, _useUserPreferencesInitListener.useUserPreferencesInitListener)(Boolean(userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.isInitialized), resolvedUserPreferences, api);
|
|
51
49
|
}
|
|
52
50
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
2
2
|
import { updateUserPreference } from './pm-plugins/commands';
|
|
3
3
|
import { createPlugin, userPreferencesPluginKey } from './pm-plugins/main';
|
|
4
|
-
import { useDocumentVisibilityWatcher } from './ui/useDocumentVisibilityWatcher';
|
|
5
4
|
import { useUserPreferencesInitListener } from './ui/useUserPreferencesInitListener';
|
|
6
5
|
import { useUserPreferencesUpdateListener } from './ui/useUserPreferencesUpdateListener';
|
|
7
6
|
export const userPreferencesPlugin = ({
|
|
@@ -43,7 +42,6 @@ export const userPreferencesPlugin = ({
|
|
|
43
42
|
resolvedUserPreferences
|
|
44
43
|
} = useResolvedUserPreferences(userPreferencesProvider);
|
|
45
44
|
useUserPreferencesUpdateListener(editorView, resolvedUserPreferences);
|
|
46
|
-
useDocumentVisibilityWatcher(userPreferencesProvider);
|
|
47
45
|
useUserPreferencesInitListener(Boolean(userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.isInitialized), resolvedUserPreferences, api);
|
|
48
46
|
}
|
|
49
47
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
2
2
|
import { updateUserPreference as _updateUserPreference } from './pm-plugins/commands';
|
|
3
3
|
import { createPlugin, userPreferencesPluginKey } from './pm-plugins/main';
|
|
4
|
-
import { useDocumentVisibilityWatcher } from './ui/useDocumentVisibilityWatcher';
|
|
5
4
|
import { useUserPreferencesInitListener } from './ui/useUserPreferencesInitListener';
|
|
6
5
|
import { useUserPreferencesUpdateListener } from './ui/useUserPreferencesUpdateListener';
|
|
7
6
|
export var userPreferencesPlugin = function userPreferencesPlugin(_ref) {
|
|
@@ -40,7 +39,6 @@ export var userPreferencesPlugin = function userPreferencesPlugin(_ref) {
|
|
|
40
39
|
var _useResolvedUserPrefe = useResolvedUserPreferences(userPreferencesProvider),
|
|
41
40
|
resolvedUserPreferences = _useResolvedUserPrefe.resolvedUserPreferences;
|
|
42
41
|
useUserPreferencesUpdateListener(editorView, resolvedUserPreferences);
|
|
43
|
-
useDocumentVisibilityWatcher(userPreferencesProvider);
|
|
44
42
|
useUserPreferencesInitListener(Boolean(userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.isInitialized), resolvedUserPreferences, api);
|
|
45
43
|
}
|
|
46
44
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
3
|
-
import { UserPreferencesPlugin } from '../userPreferencesPluginType';
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
3
|
+
import type { UserPreferencesPlugin } from '../userPreferencesPluginType';
|
|
4
4
|
export declare const useUserPreferencesInitListener: (isInitialized: boolean, resolvedUserPreferences: ResolvedUserPreferences | null, api?: ExtractInjectionAPI<UserPreferencesPlugin>) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
1
|
+
import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
2
2
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
export declare const useUserPreferencesUpdateListener: (editorView: EditorView, resolvedUserPreferences: ResolvedUserPreferences | null) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
3
|
-
import { UserPreferencesPlugin } from '../userPreferencesPluginType';
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
3
|
+
import type { UserPreferencesPlugin } from '../userPreferencesPluginType';
|
|
4
4
|
export declare const useUserPreferencesInitListener: (isInitialized: boolean, resolvedUserPreferences: ResolvedUserPreferences | null, api?: ExtractInjectionAPI<UserPreferencesPlugin>) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
1
|
+
import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
2
2
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
export declare const useUserPreferencesUpdateListener: (editorView: EditorView, resolvedUserPreferences: ResolvedUserPreferences | null) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-user-preferences",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "UserPreferences plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Editor: Lego",
|
|
12
12
|
"releaseModel": "continuous",
|
|
13
|
-
"singleton": true
|
|
14
|
-
"runReact18": true
|
|
13
|
+
"singleton": true
|
|
15
14
|
},
|
|
16
15
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
17
16
|
"main": "dist/cjs/index.js",
|
|
@@ -32,11 +31,11 @@
|
|
|
32
31
|
".": "./src/index.ts"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@atlaskit/editor-common": "^107.
|
|
34
|
+
"@atlaskit/editor-common": "^107.4.0",
|
|
36
35
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
37
36
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
38
37
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
39
|
-
"@atlaskit/tmp-editor-statsig": "^8.
|
|
38
|
+
"@atlaskit/tmp-editor-statsig": "^8.5.0",
|
|
40
39
|
"@babel/runtime": "^7.0.0",
|
|
41
40
|
"bind-event-listener": "^3.0.0"
|
|
42
41
|
},
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useDocumentVisibilityWatcher = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _bindEventListener = require("bind-event-listener");
|
|
12
|
-
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
13
|
-
var useDocumentVisibilityWatcher = exports.useDocumentVisibilityWatcher = function useDocumentVisibilityWatcher(userPreferencesProvider) {
|
|
14
|
-
(0, _react.useEffect)(function () {
|
|
15
|
-
if (userPreferencesProvider) {
|
|
16
|
-
var refreshPreferences = /*#__PURE__*/function () {
|
|
17
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
18
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
19
|
-
while (1) switch (_context.prev = _context.next) {
|
|
20
|
-
case 0:
|
|
21
|
-
if (!(document.visibilityState === 'visible')) {
|
|
22
|
-
_context.next = 9;
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
_context.prev = 1;
|
|
26
|
-
_context.next = 4;
|
|
27
|
-
return userPreferencesProvider.loadPreferences();
|
|
28
|
-
case 4:
|
|
29
|
-
_context.next = 9;
|
|
30
|
-
break;
|
|
31
|
-
case 6:
|
|
32
|
-
_context.prev = 6;
|
|
33
|
-
_context.t0 = _context["catch"](1);
|
|
34
|
-
(0, _monitoring.logException)(_context.t0, {
|
|
35
|
-
location: 'editor-plugin-user-preferences/userPreferencesPlugin'
|
|
36
|
-
});
|
|
37
|
-
case 9:
|
|
38
|
-
case "end":
|
|
39
|
-
return _context.stop();
|
|
40
|
-
}
|
|
41
|
-
}, _callee, null, [[1, 6]]);
|
|
42
|
-
}));
|
|
43
|
-
return function refreshPreferences() {
|
|
44
|
-
return _ref.apply(this, arguments);
|
|
45
|
-
};
|
|
46
|
-
}();
|
|
47
|
-
return (0, _bindEventListener.bind)(document, {
|
|
48
|
-
type: 'visibilitychange',
|
|
49
|
-
listener: refreshPreferences
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}, [userPreferencesProvider]);
|
|
53
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { bind } from 'bind-event-listener';
|
|
3
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
4
|
-
export const useDocumentVisibilityWatcher = userPreferencesProvider => {
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
if (userPreferencesProvider) {
|
|
7
|
-
const refreshPreferences = async () => {
|
|
8
|
-
if (document.visibilityState === 'visible') {
|
|
9
|
-
try {
|
|
10
|
-
await userPreferencesProvider.loadPreferences();
|
|
11
|
-
} catch (error) {
|
|
12
|
-
logException(error, {
|
|
13
|
-
location: 'editor-plugin-user-preferences/userPreferencesPlugin'
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
return bind(document, {
|
|
19
|
-
type: 'visibilitychange',
|
|
20
|
-
listener: refreshPreferences
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}, [userPreferencesProvider]);
|
|
24
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import { useEffect } from 'react';
|
|
4
|
-
import { bind } from 'bind-event-listener';
|
|
5
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
6
|
-
export var useDocumentVisibilityWatcher = function useDocumentVisibilityWatcher(userPreferencesProvider) {
|
|
7
|
-
useEffect(function () {
|
|
8
|
-
if (userPreferencesProvider) {
|
|
9
|
-
var refreshPreferences = /*#__PURE__*/function () {
|
|
10
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
11
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
12
|
-
while (1) switch (_context.prev = _context.next) {
|
|
13
|
-
case 0:
|
|
14
|
-
if (!(document.visibilityState === 'visible')) {
|
|
15
|
-
_context.next = 9;
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
_context.prev = 1;
|
|
19
|
-
_context.next = 4;
|
|
20
|
-
return userPreferencesProvider.loadPreferences();
|
|
21
|
-
case 4:
|
|
22
|
-
_context.next = 9;
|
|
23
|
-
break;
|
|
24
|
-
case 6:
|
|
25
|
-
_context.prev = 6;
|
|
26
|
-
_context.t0 = _context["catch"](1);
|
|
27
|
-
logException(_context.t0, {
|
|
28
|
-
location: 'editor-plugin-user-preferences/userPreferencesPlugin'
|
|
29
|
-
});
|
|
30
|
-
case 9:
|
|
31
|
-
case "end":
|
|
32
|
-
return _context.stop();
|
|
33
|
-
}
|
|
34
|
-
}, _callee, null, [[1, 6]]);
|
|
35
|
-
}));
|
|
36
|
-
return function refreshPreferences() {
|
|
37
|
-
return _ref.apply(this, arguments);
|
|
38
|
-
};
|
|
39
|
-
}();
|
|
40
|
-
return bind(document, {
|
|
41
|
-
type: 'visibilitychange',
|
|
42
|
-
listener: refreshPreferences
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}, [userPreferencesProvider]);
|
|
46
|
-
};
|