@manuscripts/article-editor 3.9.3-LEAN-4611.1 → 4.0.0-LEAN-4623.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/dist/{es/lib/tracking.js → cjs/__mocks__/fileMock.js} +4 -35
- package/dist/cjs/__mocks__/fileMock.js.map +1 -0
- package/dist/{types/components/FileManager/FileGroup.d.ts → cjs/__mocks__/styleMock.js} +5 -9
- package/dist/cjs/__mocks__/styleMock.js.map +1 -0
- package/dist/cjs/components/FileManager/FileActions.js +1 -3
- package/dist/cjs/components/FileManager/FileActions.js.map +1 -1
- package/dist/cjs/components/FileManager/InlineFilesSection.js +28 -77
- package/dist/cjs/components/FileManager/InlineFilesSection.js.map +1 -1
- package/dist/cjs/components/Inspector.js +60 -6
- package/dist/cjs/components/Inspector.js.map +1 -1
- package/dist/cjs/components/VersionHistoryDropdown.js +2 -2
- package/dist/cjs/components/VersionHistoryDropdown.js.map +1 -1
- package/dist/cjs/components/projects/Inspector.js +17 -11
- package/dist/cjs/components/projects/Inspector.js.map +1 -1
- package/dist/cjs/lib/{tracking.js → __tests__/layout.test.js} +25 -38
- package/dist/cjs/lib/__tests__/layout.test.js.map +1 -0
- package/dist/cjs/lib/__tests__/preferences.test.js +50 -0
- package/dist/cjs/lib/__tests__/preferences.test.js.map +1 -0
- package/dist/cjs/lib/__tests__/roles.test.js +32 -0
- package/dist/cjs/lib/__tests__/roles.test.js.map +1 -0
- package/dist/cjs/lib/change-handlers.js +28 -5
- package/dist/cjs/lib/change-handlers.js.map +1 -1
- package/dist/es/__mocks__/fileMock.js +13 -0
- package/dist/es/__mocks__/fileMock.js.map +1 -0
- package/dist/es/__mocks__/styleMock.js +13 -0
- package/dist/es/__mocks__/styleMock.js.map +1 -0
- package/dist/es/components/FileManager/FileActions.js +1 -3
- package/dist/es/components/FileManager/FileActions.js.map +1 -1
- package/dist/es/components/FileManager/InlineFilesSection.js +31 -80
- package/dist/es/components/FileManager/InlineFilesSection.js.map +1 -1
- package/dist/es/components/Inspector.js +35 -5
- package/dist/es/components/Inspector.js.map +1 -1
- package/dist/es/components/VersionHistoryDropdown.js +2 -2
- package/dist/es/components/VersionHistoryDropdown.js.map +1 -1
- package/dist/es/components/projects/Inspector.js +19 -13
- package/dist/es/components/projects/Inspector.js.map +1 -1
- package/dist/es/lib/__tests__/layout.test.js +33 -0
- package/dist/es/lib/__tests__/layout.test.js.map +1 -0
- package/dist/es/lib/__tests__/preferences.test.js +25 -0
- package/dist/es/lib/__tests__/preferences.test.js.map +1 -0
- package/dist/es/lib/__tests__/roles.test.js +30 -0
- package/dist/es/lib/__tests__/roles.test.js.map +1 -0
- package/dist/es/lib/change-handlers.js +23 -1
- package/dist/es/lib/change-handlers.js.map +1 -1
- package/dist/types/__mocks__/fileMock.d.ts +13 -0
- package/dist/types/__mocks__/styleMock.d.ts +13 -0
- package/dist/types/components/FileManager/FileActions.d.ts +0 -1
- package/dist/types/components/Inspector.d.ts +10 -0
- package/dist/types/components/projects/inputs.d.ts +1 -1
- package/dist/types/lib/{tracking.d.ts → __tests__/layout.test.d.ts} +0 -17
- package/dist/types/lib/__tests__/preferences.test.d.ts +12 -0
- package/dist/types/lib/__tests__/roles.test.d.ts +12 -0
- package/dist/types/lib/change-handlers.d.ts +1 -0
- package/package.json +78 -83
- package/dist/cjs/components/FileManager/FileGroup.js +0 -108
- package/dist/cjs/components/FileManager/FileGroup.js.map +0 -1
- package/dist/cjs/lib/tracking.js.map +0 -1
- package/dist/es/components/FileManager/FileGroup.js +0 -102
- package/dist/es/components/FileManager/FileGroup.js.map +0 -1
- package/dist/es/lib/tracking.js.map +0 -1
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*!
|
3
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
4
|
+
*
|
5
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
6
|
+
*
|
7
|
+
* The Original Code is manuscripts-frontend.
|
8
|
+
*
|
9
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
10
|
+
*
|
11
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
12
|
+
*/
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
14
|
+
if (k2 === undefined) k2 = k;
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
18
|
+
}
|
19
|
+
Object.defineProperty(o, k2, desc);
|
20
|
+
}) : (function(o, m, k, k2) {
|
21
|
+
if (k2 === undefined) k2 = k;
|
22
|
+
o[k2] = m[k];
|
23
|
+
}));
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
26
|
+
}) : function(o, v) {
|
27
|
+
o["default"] = v;
|
28
|
+
});
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
30
|
+
if (mod && mod.__esModule) return mod;
|
31
|
+
var result = {};
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
33
|
+
__setModuleDefault(result, mod);
|
34
|
+
return result;
|
35
|
+
};
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
37
|
+
const preferences_1 = __importStar(require("../preferences"));
|
38
|
+
describe('preferences', () => {
|
39
|
+
it('have defaults', () => {
|
40
|
+
expect(preferences_1.default.get()).toEqual(preferences_1.defaults);
|
41
|
+
});
|
42
|
+
it('can be set and removed', () => {
|
43
|
+
const prefs = { locale: 'ar' };
|
44
|
+
expect(preferences_1.default.set(prefs)).toEqual(prefs);
|
45
|
+
expect(preferences_1.default.get()).toEqual(prefs);
|
46
|
+
preferences_1.default.remove();
|
47
|
+
expect(preferences_1.default.get()).toEqual(preferences_1.defaults); // check that we're back to defaults
|
48
|
+
});
|
49
|
+
});
|
50
|
+
//# sourceMappingURL=preferences.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"preferences.test.js","sourceRoot":"","sources":["../../../../src/lib/__tests__/preferences.test.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8DAA6D;AAE7D,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;QACvB,MAAM,CAAC,qBAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAQ,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,MAAM,KAAK,GAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;QAC3C,MAAM,CAAC,qBAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACvC,MAAM,CAAC,qBAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAElC,qBAAK,CAAC,MAAM,EAAE,CAAA;QACd,MAAM,CAAC,qBAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAQ,CAAC,CAAA,CAAC,oCAAoC;IAC5E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*!
|
3
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
4
|
+
*
|
5
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
6
|
+
*
|
7
|
+
* The Original Code is manuscripts-frontend.
|
8
|
+
*
|
9
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
10
|
+
*
|
11
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
12
|
+
*/
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
14
|
+
const roles_1 = require("../roles");
|
15
|
+
describe('roles', () => {
|
16
|
+
const project = {
|
17
|
+
owners: ['User_A'],
|
18
|
+
viewers: ['User_B'],
|
19
|
+
writers: ['User_C'],
|
20
|
+
};
|
21
|
+
it('isOwner must return true if the user is an owner', () => expect((0, roles_1.isOwner)(project, 'User_A')).toBeTruthy());
|
22
|
+
it('isOwner must return false if the user is not an owner', () => expect((0, roles_1.isOwner)(project, 'User_D')).toBeFalsy());
|
23
|
+
it('isWriter must return true if the user is a writer', () => expect((0, roles_1.isWriter)(project, 'User_C')).toBeTruthy());
|
24
|
+
it('isWriter must return false if the user is not a writer', () => expect((0, roles_1.isWriter)(project, 'User_D')).toBeFalsy());
|
25
|
+
it('isViewer must return true if the user is a viewer', () => expect((0, roles_1.isViewer)(project, 'User_B')).toBeTruthy());
|
26
|
+
it('isViewer must return false if the user is not a viewer', () => expect((0, roles_1.isViewer)(project, 'User_D')).toBeFalsy());
|
27
|
+
it('getRole must return owner if the user is an owner', () => expect((0, roles_1.getUserRole)(project, 'User_A')).toBe(roles_1.ProjectRole.owner));
|
28
|
+
it('getRole must return writer if the user is a writer', () => expect((0, roles_1.getUserRole)(project, 'User_C')).toBe(roles_1.ProjectRole.writer));
|
29
|
+
it('getRole must return viewer if the user is a viewer', () => expect((0, roles_1.getUserRole)(project, 'User_B')).toBe(roles_1.ProjectRole.viewer));
|
30
|
+
it('getRole must return null if the user not in the project', () => expect((0, roles_1.getUserRole)(project, 'User_D')).toBeNull());
|
31
|
+
});
|
32
|
+
//# sourceMappingURL=roles.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"roles.test.js","sourceRoot":"","sources":["../../../../src/lib/__tests__/roles.test.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAIH,oCAAgF;AAEhF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,MAAM,OAAO,GAAY;QACvB,MAAM,EAAE,CAAC,QAAQ,CAAC;QAClB,OAAO,EAAE,CAAC,QAAQ,CAAC;QACnB,OAAO,EAAE,CAAC,QAAQ,CAAC;KACT,CAAA;IAEZ,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE,CAC1D,MAAM,CAAC,IAAA,eAAO,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAA;IAElD,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE,CAC/D,MAAM,CAAC,IAAA,eAAO,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA;IAEjD,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE,CAC3D,MAAM,CAAC,IAAA,gBAAQ,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAA;IAEnD,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE,CAChE,MAAM,CAAC,IAAA,gBAAQ,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA;IAElD,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE,CAC3D,MAAM,CAAC,IAAA,gBAAQ,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAA;IAEnD,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE,CAChE,MAAM,CAAC,IAAA,gBAAQ,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA;IAElD,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE,CAC3D,MAAM,CAAC,IAAA,mBAAW,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAW,CAAC,KAAK,CAAC,CAAC,CAAA;IAEjE,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE,CAC5D,MAAM,CAAC,IAAA,mBAAW,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAW,CAAC,MAAM,CAAC,CAAC,CAAA;IAElE,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE,CAC5D,MAAM,CAAC,IAAA,mBAAW,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAW,CAAC,MAAM,CAAC,CAAC,CAAA;IAElE,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE,CACjE,MAAM,CAAC,IAAA,mBAAW,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;AACtD,CAAC,CAAC,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.handleUnknownChange = exports.handleGroupChanges = exports.handleNodeChange = exports.handleTextChange = void 0;
|
3
|
+
exports.changeOperationAlias = exports.handleUnknownChange = exports.handleGroupChanges = exports.handleNodeChange = exports.handleTextChange = void 0;
|
4
4
|
/*!
|
5
5
|
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
6
6
|
*
|
@@ -16,7 +16,6 @@ const body_editor_1 = require("@manuscripts/body-editor");
|
|
16
16
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
17
17
|
const transform_1 = require("@manuscripts/transform");
|
18
18
|
const node_content_retriever_1 = require("./node-content-retriever");
|
19
|
-
const tracking_1 = require("./tracking");
|
20
19
|
const utils_1 = require("./utils");
|
21
20
|
const isAltTitleNode = (node) => node.type === transform_1.schema.nodes.alt_title;
|
22
21
|
const getTitleDisplayName = (node) => {
|
@@ -46,7 +45,7 @@ const handleTextChange = (suggestion, state) => {
|
|
46
45
|
}
|
47
46
|
}
|
48
47
|
return {
|
49
|
-
operation: (0,
|
48
|
+
operation: (0, exports.changeOperationAlias)(dataTracked.operation),
|
50
49
|
nodeName: nodeName || suggestion.nodeType.name,
|
51
50
|
content: suggestion.text,
|
52
51
|
};
|
@@ -55,7 +54,7 @@ exports.handleTextChange = handleTextChange;
|
|
55
54
|
const handleNodeChange = (suggestion, state) => {
|
56
55
|
const nodeContentRetriever = new node_content_retriever_1.NodeTextContentRetriever(state);
|
57
56
|
const { node, dataTracked } = suggestion;
|
58
|
-
const operation = (0,
|
57
|
+
const operation = (0, exports.changeOperationAlias)(dataTracked.operation);
|
59
58
|
const nodeName = transform_1.nodeNames.get(node.type) || node.type.name;
|
60
59
|
switch (node.type) {
|
61
60
|
case transform_1.schema.nodes.inline_footnote: {
|
@@ -192,7 +191,7 @@ const handleGroupChanges = (suggestions, view, doc, dataTracked) => {
|
|
192
191
|
: result?.content || '')
|
193
192
|
.join('');
|
194
193
|
return {
|
195
|
-
operation: (0,
|
194
|
+
operation: (0, exports.changeOperationAlias)(dataTracked.operation),
|
196
195
|
nodeName: titleNodeName || 'Text',
|
197
196
|
content,
|
198
197
|
};
|
@@ -206,4 +205,28 @@ const handleUnknownChange = () => {
|
|
206
205
|
};
|
207
206
|
};
|
208
207
|
exports.handleUnknownChange = handleUnknownChange;
|
208
|
+
const changeOperationAlias = (operation) => {
|
209
|
+
switch (operation) {
|
210
|
+
case 'delete': {
|
211
|
+
return 'Deleted';
|
212
|
+
}
|
213
|
+
case 'insert':
|
214
|
+
case 'wrap_with_node': {
|
215
|
+
return 'Inserted';
|
216
|
+
}
|
217
|
+
case 'set_attrs': {
|
218
|
+
return 'Updated';
|
219
|
+
}
|
220
|
+
case 'node_split': {
|
221
|
+
return 'Split';
|
222
|
+
}
|
223
|
+
case 'move': {
|
224
|
+
return 'Move';
|
225
|
+
}
|
226
|
+
default: {
|
227
|
+
return 'null';
|
228
|
+
}
|
229
|
+
}
|
230
|
+
};
|
231
|
+
exports.changeOperationAlias = changeOperationAlias;
|
209
232
|
//# sourceMappingURL=change-handlers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"change-handlers.js","sourceRoot":"","sources":["../../../src/lib/change-handlers.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,0DAKiC;AACjC,4EAM0C;AAC1C,sDAK+B;AAE/B,qEAAmE;AACnE,
|
1
|
+
{"version":3,"file":"change-handlers.js","sourceRoot":"","sources":["../../../src/lib/change-handlers.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,0DAKiC;AACjC,4EAM0C;AAC1C,sDAK+B;AAE/B,qEAAmE;AACnE,mCAAuC;AAQvC,MAAM,cAAc,GAAG,CAAC,IAAoB,EAAW,EAAE,CACvD,IAAI,CAAC,IAAI,KAAK,kBAAM,CAAC,KAAK,CAAC,SAAS,CAAA;AAEtC,MAA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AAC,CAAA;IAEX,OAAO;QACL,SAAS,EAAE,IAAA,4BAAoB,EAAC,WAAW,CAAC,SAAS,CAAC;QACtD,QAAQ,EAAE,aAAa,IAAI,MAAM;QACjC,OAAO;KACR,CAAA;AACH,CAAC,CAAA;AAvCY,QAAA,kBAAkB,sBAuC9B;AAEM,MAAM,mBAAmB,GAAG,GAAgB,EAAE;IACnD,OAAO;QACL,SAAS,EAAE,EAAE;QACb,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,iBAAiB;KAC3B,CAAA;AACH,CAAC,CAAA;AANY,QAAA,mBAAmB,uBAM/B;AAEM,MAAM,oBAAoB,GAAG,CAAC,SAAiB,EAAU,EAAE;IAChE,QAAQ,SAAS,EAAE;QACjB,KAAK,QAAQ,CAAC,CAAC;YACb,OAAO,SAAS,CAAA;SACjB;QACD,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC,CAAC;YACrB,OAAO,UAAU,CAAA;SAClB;QACD,KAAK,WAAW,CAAC,CAAC;YAChB,OAAO,SAAS,CAAA;SACjB;QACD,KAAK,YAAY,CAAC,CAAC;YACjB,OAAO,OAAO,CAAA;SACf;QACD,KAAK,MAAM,CAAC,CAAC;YACX,OAAO,MAAM,CAAA;SACd;QACD,OAAO,CAAC,CAAC;YACP,OAAO,MAAM,CAAA;SACd;KACF;AACH,CAAC,CAAA;AAtBY,QAAA,oBAAoB,wBAsBhC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*!
|
2
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
3
|
+
*
|
4
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
5
|
+
*
|
6
|
+
* The Original Code is manuscripts-frontend.
|
7
|
+
*
|
8
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
9
|
+
*
|
10
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
11
|
+
*/
|
12
|
+
export default 'test-file-stub';
|
13
|
+
//# sourceMappingURL=fileMock.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fileMock.js","sourceRoot":"","sources":["../../../src/__mocks__/fileMock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAe,gBAAgB,CAAA"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*!
|
2
|
+
* The contents of this file are subject to the Common Public Attribution License Version 1.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://mpapp-public.gitlab.io/manuscripts-frontend/LICENSE. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.
|
3
|
+
*
|
4
|
+
* Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
|
5
|
+
*
|
6
|
+
* The Original Code is manuscripts-frontend.
|
7
|
+
*
|
8
|
+
* The Original Developer is the Initial Developer. The Initial Developer of the Original Code is Atypon Systems LLC.
|
9
|
+
*
|
10
|
+
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
11
|
+
*/
|
12
|
+
export default {};
|
13
|
+
//# sourceMappingURL=styleMock.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"styleMock.js","sourceRoot":"","sources":["../../../src/__mocks__/styleMock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAe,EAAE,CAAA"}
|
@@ -4,7 +4,7 @@ import styled from 'styled-components';
|
|
4
4
|
/**
|
5
5
|
* This component represents the drop-down list action for each file item.
|
6
6
|
*/
|
7
|
-
export const FileActions = ({ sectionType, onDownload, onReplace, onDetach,
|
7
|
+
export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onUseAsMain, move, className, file, accept, }) => {
|
8
8
|
const can = usePermissions();
|
9
9
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
10
10
|
const [isMoveDialogOpen, setMoveDialogOpen] = useState(false);
|
@@ -12,7 +12,6 @@ export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onDe
|
|
12
12
|
const showDownload = can?.downloadFiles && onDownload;
|
13
13
|
const showReplace = can?.replaceFile && onReplace;
|
14
14
|
const showDetach = can?.detachFile && onDetach;
|
15
|
-
const showDelete = can?.detachFile && onDelete;
|
16
15
|
const showMove = can?.moveFile && move;
|
17
16
|
const showUseAsMain = can?.moveFile && onUseAsMain && isValidMainDocumentFormat(file);
|
18
17
|
const show = showDownload || showReplace || showDetach || showMove || showUseAsMain;
|
@@ -40,7 +39,6 @@ export const FileActions = ({ sectionType, onDownload, onReplace, onDetach, onDe
|
|
40
39
|
React.createElement(FileAction, { onClick: openFileDialog }, "Replace"),
|
41
40
|
React.createElement("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleChange, accept: accept }))),
|
42
41
|
showDetach && React.createElement(FileAction, { onClick: onDetach }, "Detach"),
|
43
|
-
showDelete && React.createElement(FileAction, { onClick: onDelete }, "Delete"),
|
44
42
|
showMove && (React.createElement(FileAction, { onClick: () => setMoveDialogOpen(true) },
|
45
43
|
"Move to ",
|
46
44
|
move.sectionType)),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileActions.js","sourceRoot":"","sources":["../../../../src/components/FileManager/FileActions.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,i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AAC,CAAA;;CAE7C,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;;;CAWvC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;;;;;;gBAM1C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO;;;;CAI/D,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;iBACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;;;;WAI7C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;;;;;;CAMpD,CAAA;AAED,MAAM,yBAAyB,GAAG,CAAC,IAAqB,EAAW,EAAE;IACnE,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,KAAK,CAAA;KACb;IAED,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAEjE,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAClC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CACpD,CAAA;AACH,CAAC,CAAA"}
|
@@ -1,32 +1,33 @@
|
|
1
|
-
import { FileFigureIcon, FileGraphicalAbstractIcon, FileImageIcon,
|
1
|
+
import { FileFigureIcon, FileGraphicalAbstractIcon, FileImageIcon, } from '@manuscripts/style-guide';
|
2
2
|
import { schema } from '@manuscripts/transform';
|
3
3
|
import { NodeSelection } from 'prosemirror-state';
|
4
4
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
5
|
-
import React, { useMemo
|
6
|
-
import { trimFilename } from '../../lib/files';
|
5
|
+
import React, { useMemo } from 'react';
|
7
6
|
import { useStore } from '../../store';
|
8
7
|
import { FileActions } from './FileActions';
|
8
|
+
import { FileContainer } from './FileContainer';
|
9
9
|
import { FileCreatedDate } from './FileCreatedDate';
|
10
|
-
import { FileGroup, FileGroupContainer, FileGroupHeader, FileGroupItemContainer, FileLabel, ToggleIcon, } from './FileGroup';
|
11
10
|
import { FileSectionType } from './FileManager';
|
12
|
-
import {
|
13
|
-
import { FileTypeIcon } from './FileTypeIcon';
|
11
|
+
import { FileName } from './FileName';
|
14
12
|
export const InlineFilesSection = ({ elements, }) => {
|
15
13
|
const [{ view, fileManagement, sectionCategories }] = useStore((s) => ({
|
16
14
|
view: s.view,
|
17
15
|
fileManagement: s.fileManagement,
|
18
16
|
sectionCategories: s.sectionCategories,
|
19
17
|
}));
|
20
|
-
const
|
18
|
+
const metadata = useMemo(() => {
|
21
19
|
if (!view) {
|
22
20
|
return [];
|
23
21
|
}
|
24
22
|
let figureIndex = 1;
|
25
23
|
let imageIndex = 1;
|
26
24
|
return elements.map((element) => {
|
25
|
+
const figure = element.files[0];
|
26
|
+
const file = figure?.file || { id: '', name: '' };
|
27
27
|
const $pos = view.state.doc.resolve(element.pos);
|
28
28
|
const section = findParentNodeOfTypeClosestToPos($pos, schema.nodes.graphical_abstract_section);
|
29
|
-
let label
|
29
|
+
let label;
|
30
|
+
let icon;
|
30
31
|
if (section) {
|
31
32
|
const category = section.node.attrs.category;
|
32
33
|
label = sectionCategories.get(category)?.titles[0] || '';
|
@@ -36,112 +37,62 @@ export const InlineFilesSection = ({ elements, }) => {
|
|
36
37
|
label = `Image ${imageIndex++}`;
|
37
38
|
icon = FileImageIcon;
|
38
39
|
}
|
40
|
+
else if (element.node.type === schema.nodes.hero_image) {
|
41
|
+
label = `Hero Image`;
|
42
|
+
icon = FileImageIcon;
|
43
|
+
}
|
39
44
|
else {
|
40
45
|
label = `Figure ${figureIndex++}`;
|
41
46
|
icon = FileFigureIcon;
|
42
47
|
}
|
43
48
|
return {
|
44
49
|
element,
|
50
|
+
node: figure?.node,
|
51
|
+
pos: figure?.pos,
|
52
|
+
file,
|
45
53
|
label,
|
46
54
|
icon,
|
47
|
-
files: element.files.filter((f) => f.file.id),
|
48
55
|
};
|
49
56
|
});
|
50
57
|
}, [elements, view, sectionCategories]);
|
51
|
-
const [openGroupIndexes, setOpenGroupIndexes] = useState(new Set(groupedMetadata.map((_, index) => index)));
|
52
|
-
const toggleGroupOpen = (groupIndex) => {
|
53
|
-
setOpenGroupIndexes((prevOpenIndexes) => {
|
54
|
-
const newOpenIndexes = new Set(prevOpenIndexes);
|
55
|
-
if (newOpenIndexes.has(groupIndex)) {
|
56
|
-
newOpenIndexes.delete(groupIndex);
|
57
|
-
}
|
58
|
-
else {
|
59
|
-
newOpenIndexes.add(groupIndex);
|
60
|
-
}
|
61
|
-
return newOpenIndexes;
|
62
|
-
});
|
63
|
-
};
|
64
58
|
if (!view) {
|
65
59
|
return null;
|
66
60
|
}
|
67
|
-
const handleClick = (
|
68
|
-
const tr = view.state.tr;
|
69
|
-
tr.setSelection(NodeSelection.create(view.state.doc, element.pos));
|
70
|
-
tr.scrollIntoView();
|
71
|
-
view.focus();
|
72
|
-
view.dispatch(tr);
|
73
|
-
};
|
74
|
-
const handleFileClick = (pos) => {
|
75
|
-
if (!pos) {
|
76
|
-
return;
|
77
|
-
}
|
61
|
+
const handleClick = (metadata) => {
|
78
62
|
const tr = view.state.tr;
|
79
|
-
tr.setSelection(NodeSelection.create(view.state.doc, pos));
|
63
|
+
tr.setSelection(NodeSelection.create(view.state.doc, metadata.element.pos));
|
80
64
|
tr.scrollIntoView();
|
81
65
|
view.focus();
|
82
66
|
view.dispatch(tr);
|
83
67
|
};
|
84
|
-
const handleDetach = (
|
85
|
-
if (!pos) {
|
68
|
+
const handleDetach = (metadata) => {
|
69
|
+
if (!metadata.pos) {
|
86
70
|
return;
|
87
71
|
}
|
88
72
|
const tr = view.state.tr;
|
89
|
-
tr.setNodeAttribute(pos, 'src', '');
|
90
|
-
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
73
|
+
tr.setNodeAttribute(metadata.pos, 'src', '');
|
74
|
+
tr.setSelection(NodeSelection.create(tr.doc, metadata.pos));
|
91
75
|
tr.scrollIntoView();
|
92
76
|
view.focus();
|
93
77
|
view.dispatch(tr);
|
94
78
|
};
|
95
|
-
const
|
96
|
-
if (!pos
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
const node = view.state.doc.nodeAt(pos);
|
100
|
-
if (node?.type === schema.nodes.figure) {
|
101
|
-
const tr = view.state.tr;
|
102
|
-
tr.delete(pos, pos + node.nodeSize);
|
103
|
-
view.dispatch(tr);
|
104
|
-
}
|
105
|
-
};
|
106
|
-
const handleReplace = async (pos, file) => {
|
107
|
-
if (!pos || !file) {
|
79
|
+
const handleReplace = async (metadata, file) => {
|
80
|
+
if (!metadata.pos) {
|
108
81
|
return;
|
109
82
|
}
|
110
83
|
const uploaded = await fileManagement.upload(file);
|
111
84
|
const tr = view.state.tr;
|
112
|
-
tr.setNodeAttribute(pos, 'src', uploaded.id);
|
113
|
-
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
85
|
+
tr.setNodeAttribute(metadata.pos, 'src', uploaded.id);
|
86
|
+
tr.setSelection(NodeSelection.create(tr.doc, metadata.pos));
|
114
87
|
tr.scrollIntoView();
|
115
88
|
view.focus();
|
116
89
|
view.dispatch(tr);
|
117
90
|
};
|
118
|
-
return (React.createElement(React.Fragment, null,
|
119
|
-
|
120
|
-
|
121
|
-
React.createElement(
|
122
|
-
|
123
|
-
group.label && React.createElement(FileLabel, null,
|
124
|
-
group.label,
|
125
|
-
":"),
|
126
|
-
group.files.length > 0 && (React.createElement(ToggleIcon, { isOpen: isOpen, onClick: (e) => {
|
127
|
-
e.stopPropagation();
|
128
|
-
toggleGroupOpen(groupIndex);
|
129
|
-
} }, isOpen ? (React.createElement(TriangleExpandedIcon, null)) : (React.createElement(TriangleCollapsedIcon, null))))),
|
130
|
-
isOpen && group.files.length > 0 && (React.createElement(FileGroup, null, group.files.map((fileAttachment, fileIndex) => (React.createElement(FileGroupItemContainer, { key: fileIndex, "data-tooltip-id": `${fileAttachment.file?.id}-file-name-tooltip`, onClick: (e) => {
|
131
|
-
e.stopPropagation();
|
132
|
-
handleFileClick(fileAttachment.pos);
|
133
|
-
} },
|
134
|
-
fileAttachment.file && (React.createElement(FileTypeIcon, { file: fileAttachment.file })),
|
135
|
-
React.createElement(FileNameText, { "data-cy": "filename" },
|
136
|
-
fileAttachment.file?.name
|
137
|
-
? trimFilename(fileAttachment.file.name, 25)
|
138
|
-
: 'Figure',
|
139
|
-
React.createElement(Tooltip, { id: `${fileAttachment.file?.id}-file-name-tooltip`, place: "bottom" }, fileAttachment.file?.name || 'Figure')),
|
140
|
-
fileAttachment.file && (React.createElement(FileCreatedDate, { file: fileAttachment.file, className: "show-on-hover" })),
|
141
|
-
React.createElement(FileActions, { sectionType: FileSectionType.Inline, onReplace: async (f) => await handleReplace(fileAttachment.pos, f), onDetach: () => handleDetach(fileAttachment.pos), onDownload: () => fileAttachment.file &&
|
142
|
-
fileManagement.download(fileAttachment.file), onDelete: fileIndex !== 0 // Skip displaying the delete option for the first figure
|
143
|
-
? () => handleDelete(fileAttachment.pos)
|
144
|
-
: undefined }))))))));
|
91
|
+
return (React.createElement(React.Fragment, null, metadata.map((e, index) => {
|
92
|
+
return (React.createElement(FileContainer, { "data-cy": "file-container", key: index, onClick: () => handleClick(e) },
|
93
|
+
React.createElement(FileName, { file: e.file, label: e.label, icon: e.icon }),
|
94
|
+
React.createElement(FileCreatedDate, { file: e.file, className: "show-on-hover" }),
|
95
|
+
React.createElement(FileActions, { "data-cy": "file-actions", sectionType: FileSectionType.Inline, onReplace: async (f) => await handleReplace(e, f), onDetach: () => handleDetach(e), onDownload: () => fileManagement.download(e.file) })));
|
145
96
|
})));
|
146
97
|
};
|
147
98
|
//# sourceMappingURL=InlineFilesSection.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"InlineFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/InlineFilesSection.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,aAAa,
|
1
|
+
{"version":3,"file":"InlineFilesSection.js","sourceRoot":"","sources":["../../../../src/components/FileManager/InlineFilesSection.tsx"],"names":[],"mappings":"AAYA,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,aAAa,GACd,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAkB,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAerC,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrE,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,cAAc,EAAE,CAAC,CAAC,cAAc;QAChC,iBAAiB,EAAE,CAAC,CAAC,iBAAiB;KACvC,CAAC,CAAC,CAAA;IAEH,MAAM,QAAQ,GAAmB,OAAO,CAAC,GAAG,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AC,CAAC,EACjD,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAC/B,UAAU,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GACjD,CACY,CACjB,CAAA;IACH,CAAC,CAAC,CACD,CACJ,CAAA;AACH,CAAC,CAAA"}
|
@@ -10,7 +10,19 @@
|
|
10
10
|
* All portions of the code written by Atypon Systems LLC are Copyright (c) 2019 Atypon Systems LLC. All Rights Reserved.
|
11
11
|
*/
|
12
12
|
import { Tab, TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/react';
|
13
|
+
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
13
14
|
import styled from 'styled-components';
|
15
|
+
export const TabLabel = ({ isVisible, children }) => {
|
16
|
+
const ref = useRef(null);
|
17
|
+
const [width, setWidth] = useState(0);
|
18
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
19
|
+
const skip = useMemo(() => !ref.current, [isVisible]); // skipping transition on mount to avoid animating the tab when page loads and looks weird
|
20
|
+
useLayoutEffect(() => {
|
21
|
+
const width = isVisible && ref.current ? ref.current.scrollWidth : 0;
|
22
|
+
setWidth(width);
|
23
|
+
}, [isVisible]);
|
24
|
+
return (React.createElement(TabText, { ref: ref, targetWidth: width, skipTransition: skip }, children));
|
25
|
+
};
|
14
26
|
export const InspectorContainer = styled.div `
|
15
27
|
border-left: 1px solid ${(props) => props.theme.colors.border.tertiary};
|
16
28
|
box-sizing: border-box;
|
@@ -29,7 +41,7 @@ export const InspectorTabs = styled(TabGroup) `
|
|
29
41
|
export const InspectorTabList = styled(TabList) `
|
30
42
|
&& {
|
31
43
|
background: none;
|
32
|
-
justify-content:
|
44
|
+
justify-content: flex-start;
|
33
45
|
font-size: ${(props) => props.theme.font.size.normal};
|
34
46
|
color: ${(props) => props.theme.colors.text.primary};
|
35
47
|
flex-shrink: 0;
|
@@ -66,15 +78,20 @@ const BaseInspectorTab = styled(Tab) `
|
|
66
78
|
`;
|
67
79
|
export const PrimaryInspectorTab = styled(BaseInspectorTab) `
|
68
80
|
&& {
|
69
|
-
padding: ${(props) => props.theme.grid.unit * 2}px
|
70
|
-
${(props) => props.theme.grid.unit *
|
71
|
-
|
81
|
+
padding: ${(props) => props.theme.grid.unit * 2.5}px
|
82
|
+
${(props) => props.theme.grid.unit * 5}px
|
83
|
+
${(props) => props.theme.grid.unit * 2.5}px;
|
84
|
+
border: 1px solid #f2f2f2;
|
72
85
|
display: flex;
|
73
86
|
align-items: center;
|
87
|
+
position: relative;
|
74
88
|
gap: 2px;
|
75
89
|
|
76
90
|
&[aria-selected='true'] {
|
77
|
-
|
91
|
+
padding-top: ${(props) => props.theme.grid.unit * 2.5 - 2}px;
|
92
|
+
border-top-color: #6e6e6e;
|
93
|
+
border-top-width: 3px;
|
94
|
+
border-bottom-color: transparent;
|
78
95
|
background: ${(props) => props.theme.colors.background.primary};
|
79
96
|
}
|
80
97
|
}
|
@@ -96,4 +113,17 @@ export const SecondaryInspectorTab = styled(BaseInspectorTab) `
|
|
96
113
|
export const InspectorTabPanelHeading = styled.div `
|
97
114
|
margin-bottom: ${(props) => props.theme.grid.unit * 4}px;
|
98
115
|
`;
|
116
|
+
export const Spacer = styled.span `
|
117
|
+
flex: 1 0 auto;
|
118
|
+
`;
|
119
|
+
export const TabText = styled.span `
|
120
|
+
margin-left: 0.1em;
|
121
|
+
overflow: hidden;
|
122
|
+
display: block;
|
123
|
+
opacity: ${(props) => (props.targetWidth > 0 ? '1' : '0')};
|
124
|
+
max-width: ${(props) => props.targetWidth}px;
|
125
|
+
transition: max-width ${(props) => (props.skipTransition ? '0s' : '0.25s')}
|
126
|
+
ease,
|
127
|
+
opacity ${(props) => (props.skipTransition ? '0s' : '0.5s')};
|
128
|
+
`;
|
99
129
|
//# sourceMappingURL=Inspector.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Inspector.js","sourceRoot":"","sources":["../../../src/components/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AE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO;eAClD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO;;;CAGzD,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAA;mBAC/B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;CACtD,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAA;;CAEhC,CAAA;AACD,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAGhC;;;;aAIW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;eAC5C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW;0BACjB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;;cAE9D,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;CAC9D,CAAA"}
|
@@ -18,7 +18,7 @@ const VersionHistoryDropdown = () => {
|
|
18
18
|
const { isOpen, toggleOpen, wrapperRef } = useDropdown();
|
19
19
|
const execCmd = useExecCmd();
|
20
20
|
return (React.createElement(DropdownContainer, { ref: wrapperRef },
|
21
|
-
React.createElement(ToggleDropdownButton, { onClick: toggleOpen },
|
21
|
+
React.createElement(ToggleDropdownButton, { "data-cy": "version-history-button", title: "Version History", onClick: toggleOpen },
|
22
22
|
React.createElement(DotsIcon, null)),
|
23
23
|
isOpen && (React.createElement(HistoryDropdownList, { "data-cy": "history-dropdown", direction: "right", width: 192, top: 5, onClick: toggleOpen },
|
24
24
|
React.createElement(DropdownItem, { onClick: () => execCmd(trackCommands.setTrackingStatus(TrackChangesStatus.viewSnapshots)) }, "Version history")))));
|
@@ -28,7 +28,7 @@ const ToggleDropdownButton = styled.button `
|
|
28
28
|
border: none;
|
29
29
|
background: transparent;
|
30
30
|
cursor: pointer;
|
31
|
-
padding
|
31
|
+
padding: 8px 16px;
|
32
32
|
&:focus {
|
33
33
|
outline: none;
|
34
34
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"VersionHistoryDropdown.js","sourceRoot":"","sources":["../../../src/components/VersionHistoryDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACZ,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,kBAAkB,EAClB,aAAa,GACd,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAE9C,MAAM,sBAAsB,GAAa,GAAG,EAAE;IAC5C,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,CAAA;IACxD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;IAE5B,OAAO,CACL,oBAAC,iBAAiB,IAAC,GAAG,EAAE,UAAU;QAChC,oBAAC,oBAAoB,
|
1
|
+
{"version":3,"file":"VersionHistoryDropdown.js","sourceRoot":"","sources":["../../../src/components/VersionHistoryDropdown.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACZ,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,kBAAkB,EAClB,aAAa,GACd,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