Skip to content

Commit 8301477

Browse files
committed
fix: fixed issues
1 parent 7ce072f commit 8301477

7 files changed

Lines changed: 20 additions & 19 deletions

File tree

packages/page-constructor-extension/src/YfmPageConstructor.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {Node} from '@gravity-ui/markdown-editor/pm/model';
1010
import {builders} from '@gravity-ui/markdown-editor/pm/test-builder';
1111
import dd from 'ts-dedent';
1212

13-
import {YfmPageConstructorSpecs} from './extension/YfmPageConstructorSpecs';
13+
import {YfmPageConstructorSpecsExtension} from './extension/YfmPageConstructorSpecs';
1414
import {YfmPageConstructorAttrs, yfmPageConstructorNodeName} from './extension/const';
1515

1616
jest.mock('@gravity-ui/markdown-editor', () => {
@@ -44,7 +44,7 @@ const {
4444
serializer,
4545
} = new ExtensionsManager({
4646
extensions: (builder) =>
47-
builder.use(BaseSchemaSpecs, {}).use(BlockquoteSpecs).use(YfmPageConstructorSpecs, {}),
47+
builder.use(BaseSchemaSpecs, {}).use(BlockquoteSpecs).use(YfmPageConstructorSpecsExtension),
4848
}).buildDeps();
4949

5050
const {doc, yfmPageConstructor, quote} = builders<'doc' | 'yfmPageConstructor' | 'quote'>(schema, {

packages/page-constructor-extension/src/extension/YfmPageConstructorNodeView/NodeView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {Node} from '@gravity-ui/markdown-editor/pm/model';
88
import type {EditorView, NodeView} from '@gravity-ui/markdown-editor/pm/view';
99
import {Portal} from '@gravity-ui/uikit';
1010

11-
import type {YfmPageConstructorOptions} from '..';
11+
import type {YfmPageConstructorExtensionOptions} from '..';
1212
import {
1313
YfmPageConstructorConsts,
1414
defaultYfmPageConstructorEntityId,
@@ -22,13 +22,13 @@ export class WYfmPageConstructorNodeView implements NodeView {
2222
private readonly view: EditorView;
2323
private readonly getPos: () => number | undefined;
2424
private readonly renderItem;
25-
private readonly options: YfmPageConstructorOptions;
25+
private readonly options: YfmPageConstructorExtensionOptions;
2626

2727
constructor(
2828
node: Node,
2929
view: EditorView,
3030
getPos: () => number | undefined,
31-
options: YfmPageConstructorOptions,
31+
options: YfmPageConstructorExtensionOptions,
3232
) {
3333
this.node = node;
3434
this.view = view;

packages/page-constructor-extension/src/extension/YfmPageConstructorNodeView/YfmPageConstructorView.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ import {Button, Flex, Icon, Loader, Menu, Popup, type PopupPlacement} from '@gra
1616

1717
import {i18n} from '../../i18n';
1818
import {YfmPageConstructorConsts} from '../YfmPageConstructorSpecs/const';
19-
import type {YfmPageConstructorOptions} from '../index';
19+
import type {YfmPageConstructorExtensionOptions} from '../index';
2020
import type {YfmPageConstructorEntitySharedState} from '../types';
2121

2222
import type {TransformerOptions} from './YfmPageConstructorPreview';
2323

2424
import './YfmPageConstructor.scss';
2525

2626
export {type TransformerOptions};
27-
export const cnYfmPageConstructor: (...args: unknown[]) => string = cn('yfm-page-constructor');
27+
export const cnYfmPageConstructor = cn('yfm-page-constructor');
2828
export const STOP_EVENT_CLASSNAME = 'prosemirror-stop-event';
2929

3030
const b = cnYfmPageConstructor;
@@ -52,7 +52,7 @@ const PageConstructorEditMode: React.FC<{
5252
initialText: string;
5353
onSave: (v: string) => void;
5454
onCancel: () => void;
55-
autoSave: YfmPageConstructorOptions['autoSave'];
55+
autoSave: YfmPageConstructorExtensionOptions['autoSave'];
5656
transformerOptions: TransformerOptions;
5757
}> = ({initialText, onSave, onCancel, autoSave, transformerOptions}) => {
5858
const {value, handleChange, handleManualSave, isSaveDisabled, isAutoSaveEnabled} = useAutoSave({
@@ -99,7 +99,7 @@ export const YfmPageConstructorView: React.FC<{
9999
onChange: (content: string) => void;
100100
onRemove: () => void;
101101
canEdit: boolean;
102-
autoSave: YfmPageConstructorOptions['autoSave'];
102+
autoSave: YfmPageConstructorExtensionOptions['autoSave'];
103103
transformerOptions: TransformerOptions;
104104
}> = ({view, node, onChange, onRemove, canEdit, autoSave, transformerOptions}) => {
105105
const entityId: string = node.attrs[YfmPageConstructorConsts.NodeAttrs.EntityId];

packages/page-constructor-extension/src/extension/YfmPageConstructorSpecs/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111

1212
export {yfmPageConstructorNodeName, YfmPageConstructorConsts} from './const';
1313

14-
export const YfmPageConstructorSpecsExtension: ExtensionAuto = (builder) => {
14+
const YfmPageConstructorSpecsExtensionFn: ExtensionAuto = (builder) => {
1515
builder
1616
.configureMd((md) => md.use(transform({bundle: false}), {}))
1717
.addNodeSpec(yfmPageConstructorNodeName, () => ({
@@ -57,7 +57,7 @@ export const YfmPageConstructorSpecsExtension: ExtensionAuto = (builder) => {
5757
});
5858
};
5959

60-
export const YfmPageConstructorSpecs = Object.assign(
61-
YfmPageConstructorSpecsExtension,
60+
export const YfmPageConstructorSpecsExtension = Object.assign(
61+
YfmPageConstructorSpecsExtensionFn,
6262
YfmPageConstructorConsts,
6363
);

packages/page-constructor-extension/src/extension/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import {Plugin} from '@gravity-ui/markdown-editor/pm/state';
44
import {WYfmPageConstructorNodeView} from './YfmPageConstructorNodeView';
55
import type {TransformerOptions} from './YfmPageConstructorNodeView/YfmPageConstructorPreview';
66
export type {TransformerOptions as YfmPageConstructorTransformerOptions};
7-
import {YfmPageConstructorSpecs} from './YfmPageConstructorSpecs';
7+
import {YfmPageConstructorSpecsExtension} from './YfmPageConstructorSpecs';
88
import {yfmPageConstructorNodeName} from './YfmPageConstructorSpecs/const';
99
import {addYfmPageConstructor} from './actions';
1010
import {YfmPageConstructorAction} from './const';
1111

12-
export type YfmPageConstructorOptions = {
12+
export type YfmPageConstructorExtensionOptions = {
1313
/** Whether the user can edit page-constructor blocks in WYSIWYG mode. @default true */
1414
canEdit?: boolean;
1515
/** Auto-save configuration for the YAML editor inside the node view. */
@@ -23,11 +23,11 @@ export type YfmPageConstructorOptions = {
2323
transformerOptions?: TransformerOptions;
2424
};
2525

26-
export const YfmPageConstructorExtension: ExtensionAuto<YfmPageConstructorOptions> = (
26+
export const YfmPageConstructorExtension: ExtensionAuto<YfmPageConstructorExtensionOptions> = (
2727
builder,
2828
options,
2929
) => {
30-
builder.use(YfmPageConstructorSpecs);
30+
builder.use(YfmPageConstructorSpecsExtension);
3131

3232
builder.addPlugin(() => {
3333
return new Plugin({
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
export {YfmPageConstructorExtension} from './extension';
2-
export type {YfmPageConstructorOptions, YfmPageConstructorTransformerOptions} from './extension';
2+
export type {
3+
YfmPageConstructorExtensionOptions,
4+
YfmPageConstructorTransformerOptions,
5+
} from './extension';

packages/page-constructor-extension/src/specs.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export {
2-
YfmPageConstructorSpecs,
32
YfmPageConstructorSpecsExtension,
43
YfmPageConstructorConsts,
54
yfmPageConstructorNodeName,
@@ -10,4 +9,3 @@ export {
109
yfmPageConstructorNodeType,
1110
defaultYfmPageConstructorEntityId,
1211
} from './extension/YfmPageConstructorSpecs/const';
13-
export {YfmPageConstructorAction} from './extension/const';

0 commit comments

Comments
 (0)