@manuscripts/body-editor 3.12.32 → 3.12.34
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/cjs/components/ChangeHandlingForm.js +3 -2
- package/dist/cjs/components/affiliations/AffiliationForm.js +77 -44
- package/dist/cjs/components/affiliations/AffiliationsModal.js +69 -58
- package/dist/cjs/components/affiliations/AffiliationsPanel.js +1 -1
- package/dist/cjs/components/affiliations/CreateAffiliationModal.js +96 -0
- package/dist/cjs/components/authors/AuthorDetailsForm.js +110 -54
- package/dist/cjs/components/authors/AuthorsModal.js +71 -48
- package/dist/cjs/components/authors/AuthorsPanel.js +2 -2
- package/dist/cjs/components/authors/CreateAuthorModal.js +121 -0
- package/dist/cjs/components/authors/CreditDrawer.js +14 -12
- package/dist/cjs/components/authors-affiliations/AuthorsAndAffiliationsModals.js +8 -24
- package/dist/cjs/components/authors-affiliations/GenericPanel.js +2 -2
- package/dist/cjs/components/authors-affiliations/ModalTabs.js +80 -0
- package/dist/cjs/components/dialog/ConfirmationDialog.js +3 -2
- package/dist/cjs/components/form/CreateModalStyles.js +24 -0
- package/dist/cjs/components/form/FormFooter.js +8 -3
- package/dist/cjs/components/form/ModalFormActions.js +19 -42
- package/dist/cjs/components/form/UnsavedLabel.js +25 -0
- package/dist/cjs/components/hooks/useAffiliationShowsErrorIndicator.js +27 -0
- package/dist/cjs/components/hooks/useAuthorShowsErrorIndicator.js +40 -0
- package/dist/cjs/components/toolbar/InsertEmbedDialog.js +4 -3
- package/dist/cjs/lib/__tests__/plugins.test.js +1 -0
- package/dist/cjs/lib/authors-and-affiliations.js +51 -0
- package/dist/cjs/lib/normalize.js +17 -5
- package/dist/cjs/testing/default-editor-data.js +1 -0
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/embed.js +1 -2
- package/dist/es/components/ChangeHandlingForm.js +3 -2
- package/dist/es/components/affiliations/AffiliationForm.js +75 -46
- package/dist/es/components/affiliations/AffiliationsModal.js +71 -60
- package/dist/es/components/affiliations/AffiliationsPanel.js +2 -2
- package/dist/es/components/affiliations/CreateAffiliationModal.js +56 -0
- package/dist/es/components/authors/AuthorDetailsForm.js +111 -56
- package/dist/es/components/authors/AuthorsModal.js +74 -51
- package/dist/es/components/authors/AuthorsPanel.js +3 -3
- package/dist/es/components/authors/CreateAuthorModal.js +81 -0
- package/dist/es/components/authors/CreditDrawer.js +13 -11
- package/dist/es/components/authors-affiliations/AuthorsAndAffiliationsModals.js +8 -24
- package/dist/es/components/authors-affiliations/GenericPanel.js +2 -2
- package/dist/es/components/authors-affiliations/ModalTabs.js +73 -0
- package/dist/es/components/dialog/ConfirmationDialog.js +3 -2
- package/dist/es/components/form/CreateModalStyles.js +18 -0
- package/dist/es/components/form/FormFooter.js +9 -4
- package/dist/es/components/form/ModalFormActions.js +18 -42
- package/dist/es/components/form/UnsavedLabel.js +18 -0
- package/dist/es/components/hooks/useAffiliationShowsErrorIndicator.js +21 -0
- package/dist/es/components/hooks/useAuthorShowsErrorIndicator.js +34 -0
- package/dist/es/components/toolbar/InsertEmbedDialog.js +4 -3
- package/dist/es/lib/__tests__/plugins.test.js +1 -0
- package/dist/es/lib/authors-and-affiliations.js +48 -0
- package/dist/es/lib/normalize.js +15 -4
- package/dist/es/testing/default-editor-data.js +1 -0
- package/dist/es/versions.js +1 -1
- package/dist/es/views/affiliations.js +1 -1
- package/dist/es/views/embed.js +1 -2
- package/dist/types/components/affiliations/AffiliationForm.d.ts +6 -2
- package/dist/types/components/affiliations/AffiliationsModal.d.ts +1 -1
- package/dist/types/components/affiliations/CreateAffiliationModal.d.ts +8 -0
- package/dist/types/components/authors/AuthorDetailsForm.d.ts +11 -1
- package/dist/types/components/authors/AuthorsPanel.d.ts +1 -1
- package/dist/types/components/authors/CreateAuthorModal.d.ts +9 -0
- package/dist/types/components/authors/CreditDrawer.d.ts +2 -4
- package/dist/types/components/authors-affiliations/ModalTabs.d.ts +22 -0
- package/dist/types/components/form/CreateModalStyles.d.ts +4 -0
- package/dist/types/components/form/FormFooter.d.ts +2 -1
- package/dist/types/components/form/ModalFormActions.d.ts +12 -6
- package/dist/types/components/form/UnsavedLabel.d.ts +10 -0
- package/dist/types/components/hooks/useAffiliationShowsErrorIndicator.d.ts +5 -0
- package/dist/types/components/hooks/useAuthorShowsErrorIndicator.d.ts +5 -0
- package/dist/types/configs/ManuscriptsEditor.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/authors-and-affiliations.d.ts +19 -0
- package/dist/types/lib/normalize.d.ts +2 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -3
- package/dist/cjs/lib/oembed.js +0 -84
- package/dist/es/lib/oembed.js +0 -76
- package/dist/types/lib/oembed.d.ts +0 -8
|
@@ -25,6 +25,7 @@ import { Language } from '../lib/languages';
|
|
|
25
25
|
import { Capabilities } from '../lib/capabilities';
|
|
26
26
|
import { FileAttachment, FileManagement } from '../lib/files';
|
|
27
27
|
import { PopperManager } from '../lib/popper';
|
|
28
|
+
export type FetchOEmbedHtml = (url: string, maxWidth: number, maxHeight: number) => Promise<string | undefined>;
|
|
28
29
|
export type CSLProps = {
|
|
29
30
|
style?: string;
|
|
30
31
|
locale?: string;
|
|
@@ -56,6 +57,7 @@ export interface EditorProps {
|
|
|
56
57
|
lockBody: boolean;
|
|
57
58
|
isViewingMode?: boolean;
|
|
58
59
|
hiddenNodeTypes?: ManuscriptNodeType[] | undefined;
|
|
60
|
+
fetchOEmbedHtml: FetchOEmbedHtml;
|
|
59
61
|
}
|
|
60
62
|
export type ExternalProps = Omit<EditorProps, 'popper' | 'dispatch'>;
|
|
61
63
|
export declare const createEditorState: (props: EditorProps) => EditorState;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export * from './lib/footnotes';
|
|
|
32
32
|
export * from './lib/template';
|
|
33
33
|
export * from './lib/doc';
|
|
34
34
|
export * from './lib/media';
|
|
35
|
+
export type { FetchOEmbedHtml } from './configs/ManuscriptsEditor';
|
|
35
36
|
export * from './plugins/comments';
|
|
36
37
|
export { selectedSuggestionKey } from './plugins/selected-suggestion';
|
|
37
38
|
export * from './selection';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ManuscriptEditorView } from '@manuscripts/transform';
|
|
17
|
+
import { AffiliationAttrs, ContributorAttrs } from './authors';
|
|
18
|
+
export declare const upsertAuthor: (view: ManuscriptEditorView, attrs: ContributorAttrs) => void;
|
|
19
|
+
export declare const upsertAffiliation: (view: ManuscriptEditorView, attrs: AffiliationAttrs) => void;
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Nodes } from '@manuscripts/transform';
|
|
17
|
-
import { ContributorAttrs } from './authors';
|
|
17
|
+
import { AffiliationAttrs, ContributorAttrs } from './authors';
|
|
18
|
+
export declare const normalizeAffiliation: (a: AffiliationAttrs) => AffiliationAttrs;
|
|
18
19
|
export declare const normalizeAuthor: (author: ContributorAttrs) => ContributorAttrs;
|
|
19
20
|
type WithID = {
|
|
20
21
|
id: string | undefined;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.12.
|
|
1
|
+
export declare const VERSION = "3.12.34";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/body-editor",
|
|
3
3
|
"description": "Prosemirror components for editing and viewing manuscripts",
|
|
4
|
-
"version": "3.12.
|
|
4
|
+
"version": "3.12.34",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@citation-js/plugin-pubmed": "0.3.0",
|
|
38
38
|
"@citation-js/plugin-ris": "0.7.18",
|
|
39
39
|
"@iarna/word-count": "1.1.2",
|
|
40
|
-
"@manuscripts/style-guide": "3.5.
|
|
40
|
+
"@manuscripts/style-guide": "3.5.12",
|
|
41
41
|
"@manuscripts/track-changes-plugin": "2.3.10",
|
|
42
42
|
"@manuscripts/transform": "4.3.38",
|
|
43
43
|
"@popperjs/core": "2.11.8",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"history": "5.3.0",
|
|
51
51
|
"lodash": "4.17.21",
|
|
52
52
|
"mathjax": "3.2.2",
|
|
53
|
-
"oembed-providers": "1.0.20250430",
|
|
54
53
|
"prosemirror-collab": "1.3.1",
|
|
55
54
|
"prosemirror-commands": "1.7.1",
|
|
56
55
|
"prosemirror-dropcursor": "1.8.2",
|
package/dist/cjs/lib/oembed.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getOEmbedHTML = exports.getOEmbedUrl = void 0;
|
|
7
|
-
const oembed_providers_1 = __importDefault(require("oembed-providers"));
|
|
8
|
-
const getOEmbedUrl = async (url, width, height) => {
|
|
9
|
-
let oembedUrl;
|
|
10
|
-
for (const provider of oembed_providers_1.default) {
|
|
11
|
-
if (provider) {
|
|
12
|
-
const { provider_url, endpoints } = provider;
|
|
13
|
-
for (const endpoint of endpoints) {
|
|
14
|
-
if (endpoint.schemes &&
|
|
15
|
-
endpoint.schemes.find((schema) => globToRegex(schema).test(url))) {
|
|
16
|
-
oembedUrl = endpoint.url.replace('{format}', 'json');
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
else if (!endpoint.schemes && url.startsWith(provider_url)) {
|
|
20
|
-
oembedUrl = endpoint.url.replace('{format}', 'json');
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (oembedUrl) {
|
|
27
|
-
const params = new URLSearchParams();
|
|
28
|
-
params.append('url', url);
|
|
29
|
-
params.set('format', 'json');
|
|
30
|
-
params.append('maxwidth', width.toString());
|
|
31
|
-
params.append('maxheight', height.toString());
|
|
32
|
-
return `${oembedUrl}?${params.toString()}`;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
try {
|
|
36
|
-
const response = await fetch(url, { method: 'HEAD' });
|
|
37
|
-
let oembedUrl;
|
|
38
|
-
const linkHeader = response.headers.get('link');
|
|
39
|
-
if (linkHeader) {
|
|
40
|
-
linkHeader.split(',').map((link) => {
|
|
41
|
-
const typeMatch = /type="([^"]*)"/.exec(link);
|
|
42
|
-
if (typeMatch &&
|
|
43
|
-
(typeMatch[1] === 'application/json+oembed' ||
|
|
44
|
-
typeMatch[1] === 'text/xml+oembed')) {
|
|
45
|
-
oembedUrl = /<([^>]*)>/.exec(link);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return oembedUrl;
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
exports.getOEmbedUrl = getOEmbedUrl;
|
|
57
|
-
const globToRegex = (glob) => {
|
|
58
|
-
const regex = glob
|
|
59
|
-
.replace(/\./g, '\\.')
|
|
60
|
-
.replace(/\*/g, '.*');
|
|
61
|
-
return new RegExp(`^${regex}$`);
|
|
62
|
-
};
|
|
63
|
-
const getOEmbedHTML = async (url, width, height) => {
|
|
64
|
-
try {
|
|
65
|
-
const oembedUrl = await (0, exports.getOEmbedUrl)(url, width, height);
|
|
66
|
-
if (!oembedUrl) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const response = await fetch(oembedUrl);
|
|
70
|
-
if (response.status === 200) {
|
|
71
|
-
const json = await response.json();
|
|
72
|
-
return json.html || renderAlternativeHTML(json);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
catch (e) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
exports.getOEmbedHTML = getOEmbedHTML;
|
|
80
|
-
const renderAlternativeHTML = (oembed) => {
|
|
81
|
-
if (oembed.type === 'photo') {
|
|
82
|
-
return `<img src="${oembed.url}">`;
|
|
83
|
-
}
|
|
84
|
-
};
|
package/dist/es/lib/oembed.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import providers from 'oembed-providers';
|
|
2
|
-
export const getOEmbedUrl = async (url, width, height) => {
|
|
3
|
-
let oembedUrl;
|
|
4
|
-
for (const provider of providers) {
|
|
5
|
-
if (provider) {
|
|
6
|
-
const { provider_url, endpoints } = provider;
|
|
7
|
-
for (const endpoint of endpoints) {
|
|
8
|
-
if (endpoint.schemes &&
|
|
9
|
-
endpoint.schemes.find((schema) => globToRegex(schema).test(url))) {
|
|
10
|
-
oembedUrl = endpoint.url.replace('{format}', 'json');
|
|
11
|
-
break;
|
|
12
|
-
}
|
|
13
|
-
else if (!endpoint.schemes && url.startsWith(provider_url)) {
|
|
14
|
-
oembedUrl = endpoint.url.replace('{format}', 'json');
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
if (oembedUrl) {
|
|
21
|
-
const params = new URLSearchParams();
|
|
22
|
-
params.append('url', url);
|
|
23
|
-
params.set('format', 'json');
|
|
24
|
-
params.append('maxwidth', width.toString());
|
|
25
|
-
params.append('maxheight', height.toString());
|
|
26
|
-
return `${oembedUrl}?${params.toString()}`;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
try {
|
|
30
|
-
const response = await fetch(url, { method: 'HEAD' });
|
|
31
|
-
let oembedUrl;
|
|
32
|
-
const linkHeader = response.headers.get('link');
|
|
33
|
-
if (linkHeader) {
|
|
34
|
-
linkHeader.split(',').map((link) => {
|
|
35
|
-
const typeMatch = /type="([^"]*)"/.exec(link);
|
|
36
|
-
if (typeMatch &&
|
|
37
|
-
(typeMatch[1] === 'application/json+oembed' ||
|
|
38
|
-
typeMatch[1] === 'text/xml+oembed')) {
|
|
39
|
-
oembedUrl = /<([^>]*)>/.exec(link);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return oembedUrl;
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const globToRegex = (glob) => {
|
|
51
|
-
const regex = glob
|
|
52
|
-
.replace(/\./g, '\\.')
|
|
53
|
-
.replace(/\*/g, '.*');
|
|
54
|
-
return new RegExp(`^${regex}$`);
|
|
55
|
-
};
|
|
56
|
-
export const getOEmbedHTML = async (url, width, height) => {
|
|
57
|
-
try {
|
|
58
|
-
const oembedUrl = await getOEmbedUrl(url, width, height);
|
|
59
|
-
if (!oembedUrl) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const response = await fetch(oembedUrl);
|
|
63
|
-
if (response.status === 200) {
|
|
64
|
-
const json = await response.json();
|
|
65
|
-
return json.html || renderAlternativeHTML(json);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const renderAlternativeHTML = (oembed) => {
|
|
73
|
-
if (oembed.type === 'photo') {
|
|
74
|
-
return `<img src="${oembed.url}">`;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type ProviderJson = {
|
|
2
|
-
type: 'photo' | 'video' | 'link' | 'rich';
|
|
3
|
-
html?: string;
|
|
4
|
-
url?: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const getOEmbedUrl: (url: string, width: number, height: number) => Promise<string | undefined>;
|
|
8
|
-
export declare const getOEmbedHTML: (url: string, width: number, height: number) => Promise<any>;
|