@elementor/editor-documents 0.11.4 → 0.11.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 +16 -105
- package/dist/index.js +41 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +42 -42
- package/src/hooks/__tests__/use-active-document-actions.test.ts +3 -11
- package/src/hooks/__tests__/use-active-document.test.tsx +1 -1
- package/src/hooks/__tests__/use-host-document.test.tsx +15 -11
- package/src/hooks/__tests__/use-sync-document-title.test.ts +42 -32
- package/src/hooks/use-sync-document-title.ts +2 -5
- package/src/index.ts +1 -3
- package/src/store/index.ts +11 -11
- package/src/store/selectors.ts +5 -13
- package/src/sync/__tests__/sync-store.test.ts +105 -108
- package/src/sync/__tests__/test-utils.ts +23 -19
- package/src/sync/sync-store.ts +52 -71
- package/src/sync/utils.ts +3 -2
- package/src/types.ts +58 -58
package/src/types.ts
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
1
|
export type ExitTo = 'dashboard' | 'all_posts' | 'this_post';
|
|
2
2
|
|
|
3
3
|
export type Document = {
|
|
4
|
-
id: number
|
|
5
|
-
title: string
|
|
4
|
+
id: number;
|
|
5
|
+
title: string;
|
|
6
6
|
type: {
|
|
7
|
-
value: string
|
|
8
|
-
label: string
|
|
9
|
-
}
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
};
|
|
10
10
|
status: {
|
|
11
|
-
value: string
|
|
12
|
-
label: string
|
|
13
|
-
}
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
14
|
links: {
|
|
15
|
-
platformEdit: string
|
|
16
|
-
permalink: string
|
|
17
|
-
}
|
|
18
|
-
isDirty: boolean
|
|
19
|
-
isSaving: boolean
|
|
20
|
-
isSavingDraft: boolean
|
|
15
|
+
platformEdit: string;
|
|
16
|
+
permalink: string;
|
|
17
|
+
};
|
|
18
|
+
isDirty: boolean;
|
|
19
|
+
isSaving: boolean;
|
|
20
|
+
isSavingDraft: boolean;
|
|
21
21
|
userCan: {
|
|
22
|
-
publish?: boolean
|
|
23
|
-
}
|
|
22
|
+
publish?: boolean;
|
|
23
|
+
};
|
|
24
24
|
permissions: {
|
|
25
|
-
allowAddingWidgets: boolean
|
|
26
|
-
showCopyAndShare: boolean
|
|
27
|
-
}
|
|
25
|
+
allowAddingWidgets: boolean;
|
|
26
|
+
showCopyAndShare: boolean;
|
|
27
|
+
};
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export type ExtendedWindow = Window & {
|
|
31
31
|
elementor: {
|
|
32
32
|
documents: {
|
|
33
|
-
documents: Record<string, V1Document
|
|
34
|
-
getCurrentId: () => number
|
|
35
|
-
getInitialId: () => number
|
|
36
|
-
getCurrent: () => V1Document
|
|
37
|
-
}
|
|
38
|
-
getPreferences: ( key: 'exit_to' ) => ExitTo
|
|
39
|
-
}
|
|
40
|
-
}
|
|
33
|
+
documents: Record< string, V1Document >;
|
|
34
|
+
getCurrentId: () => number;
|
|
35
|
+
getInitialId: () => number;
|
|
36
|
+
getCurrent: () => V1Document;
|
|
37
|
+
};
|
|
38
|
+
getPreferences: ( key: 'exit_to' ) => ExitTo;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
41
|
|
|
42
42
|
export type V1Document = {
|
|
43
|
-
id: number
|
|
43
|
+
id: number;
|
|
44
44
|
config: {
|
|
45
|
-
type: string
|
|
45
|
+
type: string;
|
|
46
46
|
user: {
|
|
47
|
-
can_publish: boolean
|
|
48
|
-
}
|
|
47
|
+
can_publish: boolean;
|
|
48
|
+
};
|
|
49
49
|
revisions: {
|
|
50
|
-
current_id: number
|
|
51
|
-
}
|
|
50
|
+
current_id: number;
|
|
51
|
+
};
|
|
52
52
|
panel: {
|
|
53
|
-
title: string
|
|
54
|
-
allow_adding_widgets: boolean
|
|
55
|
-
show_copy_and_share: boolean
|
|
56
|
-
}
|
|
53
|
+
title: string;
|
|
54
|
+
allow_adding_widgets: boolean;
|
|
55
|
+
show_copy_and_share: boolean;
|
|
56
|
+
};
|
|
57
57
|
status: {
|
|
58
|
-
value: string
|
|
59
|
-
label: string
|
|
60
|
-
}
|
|
58
|
+
value: string;
|
|
59
|
+
label: string;
|
|
60
|
+
};
|
|
61
61
|
urls: {
|
|
62
|
-
exit_to_dashboard: string
|
|
63
|
-
permalink: string
|
|
64
|
-
main_dashboard: string
|
|
65
|
-
all_post_type: string
|
|
66
|
-
}
|
|
67
|
-
}
|
|
62
|
+
exit_to_dashboard: string;
|
|
63
|
+
permalink: string;
|
|
64
|
+
main_dashboard: string;
|
|
65
|
+
all_post_type: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
68
|
editor: {
|
|
69
|
-
isChanged: boolean
|
|
70
|
-
isSaving: boolean
|
|
71
|
-
}
|
|
69
|
+
isChanged: boolean;
|
|
70
|
+
isSaving: boolean;
|
|
71
|
+
};
|
|
72
72
|
container: {
|
|
73
|
-
settings: V1Model<{
|
|
74
|
-
post_title: string
|
|
75
|
-
exit_to: ExitTo
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
73
|
+
settings: V1Model< {
|
|
74
|
+
post_title: string;
|
|
75
|
+
exit_to: ExitTo;
|
|
76
|
+
} >;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
79
|
|
|
80
|
-
type V1Model<T> = {
|
|
81
|
-
get: <K extends keyof T = keyof T>( key: K ) => T[K]
|
|
82
|
-
}
|
|
80
|
+
type V1Model< T > = {
|
|
81
|
+
get: < K extends keyof T = keyof T >( key: K ) => T[ K ];
|
|
82
|
+
};
|