@atlaskit/editor-plugin-user-preferences 24.0.4 → 24.0.5
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 +6 -0
- package/dist/cjs/pm-plugins/commands.js +7 -7
- package/dist/cjs/ui/useDocumentVisibilityWatcher.js +2 -2
- package/dist/cjs/ui/useUserPreferencesInitListener.js +5 -5
- package/dist/cjs/userPreferencesPlugin.js +2 -2
- package/dist/es2019/pm-plugins/commands.js +2 -2
- package/dist/es2019/ui/useDocumentVisibilityWatcher.js +1 -1
- package/dist/es2019/ui/useUserPreferencesInitListener.js +1 -1
- package/dist/es2019/userPreferencesPlugin.js +1 -1
- package/dist/esm/pm-plugins/commands.js +2 -2
- package/dist/esm/ui/useDocumentVisibilityWatcher.js +1 -1
- package/dist/esm/ui/useUserPreferencesInitListener.js +1 -1
- package/dist/esm/userPreferencesPlugin.js +1 -1
- package/dist/types/pm-plugins/commands.d.ts +4 -3
- package/dist/types/pm-plugins/main.d.ts +2 -2
- package/dist/types/ui/useDocumentVisibilityWatcher.d.ts +1 -1
- package/dist/types/ui/useUserPreferencesInitListener.d.ts +2 -2
- package/dist/types/ui/useUserPreferencesUpdateListener.d.ts +1 -1
- package/dist/types/userPreferencesPluginType.d.ts +5 -3
- package/docs/0-intro.tsx +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.updateUserPreference = exports.overrideUserPreference = exports.clearOverrideUserPreference = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
10
|
+
var _error = require("@atlaskit/editor-common/monitoring/error");
|
|
11
11
|
var _main = require("./main");
|
|
12
12
|
var overrideUserPreference = exports.overrideUserPreference = function overrideUserPreference(_ref) {
|
|
13
13
|
var key = _ref.key,
|
|
@@ -46,7 +46,7 @@ var updateUserPreference = exports.updateUserPreference = function updateUserPre
|
|
|
46
46
|
try {
|
|
47
47
|
userPreferencesProvider === null || userPreferencesProvider === void 0 || userPreferencesProvider.updatePreference(key, value);
|
|
48
48
|
} catch (error) {
|
|
49
|
-
(0,
|
|
49
|
+
(0, _error.logException)(error, {
|
|
50
50
|
location: 'editor-plugin-user-preferences/userPreferencesPlugin'
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -58,13 +58,13 @@ var updateUserPreference = exports.updateUserPreference = function updateUserPre
|
|
|
58
58
|
});
|
|
59
59
|
if (key === 'toolbarDockingPosition') {
|
|
60
60
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
61
|
-
action:
|
|
62
|
-
actionSubject:
|
|
63
|
-
actionSubjectId:
|
|
61
|
+
action: _enums.ACTION.UPDATED,
|
|
62
|
+
actionSubject: _enums.ACTION_SUBJECT.USER_PREFERENCES,
|
|
63
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
|
|
64
64
|
attributes: {
|
|
65
65
|
toolbarDocking: value
|
|
66
66
|
},
|
|
67
|
-
eventType:
|
|
67
|
+
eventType: _enums.EVENT_TYPE.TRACK
|
|
68
68
|
})(tr);
|
|
69
69
|
}
|
|
70
70
|
return tr;
|
|
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _bindEventListener = require("bind-event-listener");
|
|
12
|
-
var
|
|
12
|
+
var _error = require("@atlaskit/editor-common/monitoring/error");
|
|
13
13
|
var useDocumentVisibilityWatcher = exports.useDocumentVisibilityWatcher = function useDocumentVisibilityWatcher(userPreferencesProvider) {
|
|
14
14
|
(0, _react.useEffect)(function () {
|
|
15
15
|
if (userPreferencesProvider) {
|
|
@@ -32,7 +32,7 @@ var useDocumentVisibilityWatcher = exports.useDocumentVisibilityWatcher = functi
|
|
|
32
32
|
case 3:
|
|
33
33
|
_context.prev = 3;
|
|
34
34
|
_t = _context["catch"](1);
|
|
35
|
-
(0,
|
|
35
|
+
(0, _error.logException)(_t, {
|
|
36
36
|
location: 'editor-plugin-user-preferences/userPreferencesPlugin'
|
|
37
37
|
});
|
|
38
38
|
case 4:
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useUserPreferencesInitListener = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
8
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
9
9
|
var useUserPreferencesInitListener = exports.useUserPreferencesInitListener = function useUserPreferencesInitListener(isInitialized, resolvedUserPreferences, api) {
|
|
10
10
|
var isInitializedRef = (0, _react.useRef)(false);
|
|
11
11
|
(0, _react.useEffect)(function () {
|
|
@@ -13,13 +13,13 @@ var useUserPreferencesInitListener = exports.useUserPreferencesInitListener = fu
|
|
|
13
13
|
var _api$analytics;
|
|
14
14
|
isInitializedRef.current = true;
|
|
15
15
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
|
|
16
|
-
action:
|
|
17
|
-
actionSubject:
|
|
18
|
-
actionSubjectId:
|
|
16
|
+
action: _enums.ACTION.INITIALISED,
|
|
17
|
+
actionSubject: _enums.ACTION_SUBJECT.USER_PREFERENCES,
|
|
18
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
|
|
19
19
|
attributes: {
|
|
20
20
|
toolbarDocking: resolvedUserPreferences.toolbarDockingPosition
|
|
21
21
|
},
|
|
22
|
-
eventType:
|
|
22
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
}, [api, isInitialized, resolvedUserPreferences]);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.userPreferencesPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var
|
|
9
|
+
var _hooks = require("@atlaskit/editor-common/user-preferences/hooks");
|
|
10
10
|
var _commands = require("./pm-plugins/commands");
|
|
11
11
|
var _main = require("./pm-plugins/main");
|
|
12
12
|
var _useDocumentVisibilityWatcher = require("./ui/useDocumentVisibilityWatcher");
|
|
@@ -76,7 +76,7 @@ var userPreferencesPlugin = exports.userPreferencesPlugin = function userPrefere
|
|
|
76
76
|
},
|
|
77
77
|
usePluginHook: function usePluginHook(_ref2) {
|
|
78
78
|
var editorView = _ref2.editorView;
|
|
79
|
-
var _useResolvedUserPrefe = (0,
|
|
79
|
+
var _useResolvedUserPrefe = (0, _hooks.useResolvedUserPreferences)(userPreferencesProvider),
|
|
80
80
|
resolvedUserPreferences = _useResolvedUserPrefe.resolvedUserPreferences;
|
|
81
81
|
(0, _useUserPreferencesUpdateListener.useUserPreferencesUpdateListener)(editorView, resolvedUserPreferences);
|
|
82
82
|
(0, _useDocumentVisibilityWatcher.useDocumentVisibilityWatcher)(userPreferencesProvider);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
2
|
+
import { logException } from '@atlaskit/editor-common/monitoring/error';
|
|
3
3
|
import { userPreferencesPluginKey } from './main';
|
|
4
4
|
export const overrideUserPreference = ({
|
|
5
5
|
key,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
3
|
+
import { logException } from '@atlaskit/editor-common/monitoring/error';
|
|
4
4
|
export const useDocumentVisibilityWatcher = userPreferencesProvider => {
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
if (userPreferencesProvider) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
3
3
|
export const useUserPreferencesInitListener = (isInitialized, resolvedUserPreferences, api) => {
|
|
4
4
|
const isInitializedRef = useRef(false);
|
|
5
5
|
useEffect(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
1
|
+
import { useResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences/hooks';
|
|
2
2
|
import { clearOverrideUserPreference, overrideUserPreference, updateUserPreference } from './pm-plugins/commands';
|
|
3
3
|
import { createPlugin, userPreferencesPluginKey } from './pm-plugins/main';
|
|
4
4
|
import { useDocumentVisibilityWatcher } from './ui/useDocumentVisibilityWatcher';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
2
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
3
|
+
import { logException } from '@atlaskit/editor-common/monitoring/error';
|
|
4
4
|
import { userPreferencesPluginKey } from './main';
|
|
5
5
|
export var overrideUserPreference = function overrideUserPreference(_ref) {
|
|
6
6
|
var key = _ref.key,
|
|
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { bind } from 'bind-event-listener';
|
|
5
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
5
|
+
import { logException } from '@atlaskit/editor-common/monitoring/error';
|
|
6
6
|
export var useDocumentVisibilityWatcher = function useDocumentVisibilityWatcher(userPreferencesProvider) {
|
|
7
7
|
useEffect(function () {
|
|
8
8
|
if (userPreferencesProvider) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
3
3
|
export var useUserPreferencesInitListener = function useUserPreferencesInitListener(isInitialized, resolvedUserPreferences, api) {
|
|
4
4
|
var isInitializedRef = useRef(false);
|
|
5
5
|
useEffect(function () {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { useResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
4
|
+
import { useResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences/hooks';
|
|
5
5
|
import { clearOverrideUserPreference as _clearOverrideUserPreference, overrideUserPreference as _overrideUserPreference, updateUserPreference as _updateUserPreference } from './pm-plugins/commands';
|
|
6
6
|
import { createPlugin, userPreferencesPluginKey } from './pm-plugins/main';
|
|
7
7
|
import { useDocumentVisibilityWatcher } from './ui/useDocumentVisibilityWatcher';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type {
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics/api';
|
|
2
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types/editor-command';
|
|
3
|
+
import type { UserPreferencesProvider } from '@atlaskit/editor-common/user-preferences-provider';
|
|
4
|
+
import type { ResolvedUserPreferences, UserPreferences } from '@atlaskit/editor-common/user-preferences/user-preferences';
|
|
4
5
|
export declare const overrideUserPreference: ({ key, value, }: {
|
|
5
6
|
key: keyof ResolvedUserPreferences;
|
|
6
7
|
value: ResolvedUserPreferences[typeof key];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
3
|
+
import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences/user-preferences';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { UserPreferencesPluginOptions, UserPreferencesPlugin } from '../userPreferencesPluginType';
|
|
6
6
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { UserPreferencesProvider } from '@atlaskit/editor-common/user-preferences';
|
|
1
|
+
import type { UserPreferencesProvider } from '@atlaskit/editor-common/user-preferences-provider';
|
|
2
2
|
export declare const useDocumentVisibilityWatcher: (userPreferencesProvider?: UserPreferencesProvider) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
2
|
+
import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences/user-preferences';
|
|
3
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 type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences';
|
|
1
|
+
import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences/user-preferences';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
export declare const useUserPreferencesUpdateListener: (editorView: EditorView, resolvedUserPreferences: ResolvedUserPreferences | null) => void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { EditorCommand
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types/editor-command';
|
|
2
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
3
|
+
import type { UserPreferencesProvider } from '@atlaskit/editor-common/user-preferences-provider';
|
|
4
|
+
import type { ResolvedUserPreferences, UserPreferences } from '@atlaskit/editor-common/user-preferences/user-preferences';
|
|
5
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics/analyticsPluginType';
|
|
4
6
|
export type UserPreferencesPluginOptions = {
|
|
5
7
|
/**
|
|
6
8
|
* The initial user preferences to be used when the userPreferencesProvider is not available.
|
package/docs/0-intro.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { AtlassianInternalWarning, code, md } from '@atlaskit/docs';
|
|
4
|
-
import { createEditorUseOnlyNotice } from '@atlaskit/editor-common/doc-utils';
|
|
4
|
+
import { createEditorUseOnlyNotice } from '@atlaskit/editor-common/doc-utils/editor-use-only';
|
|
5
5
|
import { token } from '@atlaskit/tokens';
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- md template from @atlaskit/docs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-user-preferences",
|
|
3
|
-
"version": "24.0.
|
|
3
|
+
"version": "24.0.5",
|
|
4
4
|
"description": "UserPreferences plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@atlaskit/editor-plugin-analytics": "^26.0.0",
|
|
29
29
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
30
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
30
|
+
"@atlaskit/tmp-editor-statsig": "^232.0.0",
|
|
31
31
|
"@babel/runtime": "^7.0.0",
|
|
32
32
|
"bind-event-listener": "^3.0.0"
|
|
33
33
|
},
|