@manuscripts/style-guide 1.0.2 → 1.0.3
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.
|
@@ -35,16 +35,18 @@ const FileInfo_1 = require("./FileSectionItem/FileInfo");
|
|
|
35
35
|
const FileSectionItem_1 = require("./FileSectionItem/FileSectionItem");
|
|
36
36
|
const ItemActions_1 = require("./FileSectionItem/ItemActions");
|
|
37
37
|
const util_1 = require("./util");
|
|
38
|
+
const trackedJoint = ':dataTracked:';
|
|
38
39
|
const InlineFilesSection = ({ handleReplace, handleDownload, handleUpdateInline, handleDetachFile, inlineFiles, isEditor, dispatch, }) => {
|
|
39
40
|
const onElementClick = (0, react_1.useCallback)((e) => {
|
|
40
41
|
if (!isEditor) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
const { id } = e.currentTarget;
|
|
44
|
-
const
|
|
45
|
-
|
|
45
|
+
const clearedId = id.split(trackedJoint)[0];
|
|
46
|
+
const isSelected = clearedId == window.location.hash.substr(1);
|
|
47
|
+
window.location.hash = !isSelected ? `#${clearedId}` : '#';
|
|
46
48
|
if (isSelected) {
|
|
47
|
-
window.location.hash = `#${
|
|
49
|
+
window.location.hash = `#${clearedId}`;
|
|
48
50
|
}
|
|
49
51
|
}, [isEditor]);
|
|
50
52
|
return (react_1.default.createElement("div", null, inlineFiles.map((file, index) => {
|
|
@@ -6,16 +6,18 @@ import { FileInfoContainer, FileNameTitleContainer, FileTitle, } from './FileSec
|
|
|
6
6
|
import { ActionsIcon, Item, } from './FileSectionItem/FileSectionItem';
|
|
7
7
|
import { ItemActions } from './FileSectionItem/ItemActions';
|
|
8
8
|
import { extensionsWithFileTypesMap, fileTypesWithIconMap, } from './util';
|
|
9
|
+
const trackedJoint = ':dataTracked:';
|
|
9
10
|
export const InlineFilesSection = ({ handleReplace, handleDownload, handleUpdateInline, handleDetachFile, inlineFiles, isEditor, dispatch, }) => {
|
|
10
11
|
const onElementClick = useCallback((e) => {
|
|
11
12
|
if (!isEditor) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
const { id } = e.currentTarget;
|
|
15
|
-
const
|
|
16
|
-
|
|
16
|
+
const clearedId = id.split(trackedJoint)[0];
|
|
17
|
+
const isSelected = clearedId == window.location.hash.substr(1);
|
|
18
|
+
window.location.hash = !isSelected ? `#${clearedId}` : '#';
|
|
17
19
|
if (isSelected) {
|
|
18
|
-
window.location.hash = `#${
|
|
20
|
+
window.location.hash = `#${clearedId}`;
|
|
19
21
|
}
|
|
20
22
|
}, [isEditor]);
|
|
21
23
|
return (React.createElement("div", null, inlineFiles.map((file, index) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
package/NOTICE
DELETED