Skip to content

Commit

Permalink
refactor: remove exported prosmirror methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Jan 18, 2021
1 parent 5f44d4a commit 86a8a82
Show file tree
Hide file tree
Showing 27 changed files with 31 additions and 77 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component, Input, OnInit } from '@angular/core';
import { EditorState, Plugin, PluginKey, Transaction } from 'prosemirror-state';
import { EditorView } from 'prosemirror-view';
import { setBlockType } from 'prosemirror-commands';

import { Editor } from 'ngx-editor';
import { isNodeActive } from 'ngx-editor/helpers';
import { setBlockType } from 'ngx-editor/commands';

@Component({
selector: 'app-custom-menu',
Expand Down
3 changes: 1 addition & 2 deletions demo/src/app/nodeviews/CodeMirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { undo, redo } from 'prosemirror-history';
import { TextSelection, Selection } from 'prosemirror-state';
import { Node as ProsemirrorNode } from 'prosemirror-model';
import { EditorView } from 'prosemirror-view';

import { exitCode } from 'ngx-editor/commands';
import { exitCode } from 'prosemirror-commands';

import CodeMirror from 'codemirror';
import 'codemirror/mode/javascript/javascript';
Expand Down
4 changes: 2 additions & 2 deletions docs/collab.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
redo,
} from 'y-prosemirror';
import { Editor } from 'ngx-editor';
import { history } from 'ngx-editor/history';
import { keymap } from 'ngx-editor/keymap';
import { keymap } from 'prosemirror-keymap';
import { history } from 'prosemirror-history';

const ydoc = new Y.Doc();
const provider = new WebsocketProvider(
Expand Down
6 changes: 0 additions & 6 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,3 @@ this.editor.commands
You must invoke `exec` method at the end to apply the changes to the editor.

**Note:** `exec` method is not chainable.

Some commands are exported. Can be accessed via

```ts
import { toggleMark } from 'ngx-editor/commands';
```
3 changes: 1 addition & 2 deletions src/commands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"lib": {
"entryFile": "./public_api.ts",
"umdModuleIds": {
"prosemirror-state": "prosemirrorState",
"prosemirror-commands": "prosemirrorCommands"
"prosemirror-state": "prosemirrorState"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/commands/public_api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from 'prosemirror-commands';
export * from './removeLink';
export * from './applyMark';
export * from './removeMark';
10 changes: 0 additions & 10 deletions src/history/package.json

This file was deleted.

1 change: 0 additions & 1 deletion src/history/public_api.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/inputrules/package.json

This file was deleted.

1 change: 0 additions & 1 deletion src/inputrules/public_api.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/keymap/package.json

This file was deleted.

1 change: 0 additions & 1 deletion src/keymap/public_api.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/EditorCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { EditorView } from 'prosemirror-view';
import {
chainCommands, createParagraphNear, liftEmptyBlock,
newlineInCode, splitBlock
} from 'ngx-editor/commands';
} from 'prosemirror-commands';

import MarkCommand from './commands/Mark';
import ListCommand from './commands/ListItem';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/commands/Blockquote.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NodeType } from 'prosemirror-model';
import { EditorState, Transaction } from 'prosemirror-state';
import { Command, lift, wrapIn } from 'prosemirror-commands';

import { Command, lift, wrapIn } from 'ngx-editor/commands';
import { isNodeActive } from 'ngx-editor/helpers';

import { SimpleCommand } from './types';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/commands/Heading.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NodeType, Node as ProsemirrorNode } from 'prosemirror-model';
import { EditorState, Transaction } from 'prosemirror-state';
import { Command, setBlockType } from 'prosemirror-commands';

import { Command, setBlockType } from 'ngx-editor/commands';
import { getSelectionNodes } from 'ngx-editor/helpers';

export type HeadingLevels = 1 | 2 | 3 | 4 | 5 | 6;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/commands/Image.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EditorState, NodeSelection } from 'prosemirror-state';
import { Command } from 'prosemirror-commands';

import { Command } from 'ngx-editor/commands';
import { Dispatch } from './types';

export interface ImageAttrs {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/commands/Link.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { MarkType } from 'prosemirror-model';
import { EditorState } from 'prosemirror-state';
import { Command, toggleMark } from 'prosemirror-commands';

import { isMarkActive } from 'ngx-editor/helpers';
import { removeLink, Command, toggleMark } from 'ngx-editor/commands';
import { removeLink } from 'ngx-editor/commands';
import { Dispatch } from './types';

const defaultOptions = {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/commands/ListItem.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NodeType, Schema } from 'prosemirror-model';
import { EditorState, Transaction } from 'prosemirror-state';
import { liftListItem, wrapInList } from 'prosemirror-schema-list';
import { Command } from 'prosemirror-commands';

import { isNodeActive } from 'ngx-editor/helpers';
import { liftListItem, wrapInList } from 'ngx-editor/schema-list';
import { Command } from 'ngx-editor/commands';

import { SimpleCommand } from './types';

Expand Down
3 changes: 2 additions & 1 deletion src/lib/commands/Mark.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { MarkType } from 'prosemirror-model';
import { EditorState, Transaction } from 'prosemirror-state';
import { Command, toggleMark } from 'prosemirror-commands';

import { applyMark } from 'ngx-editor/commands';
import { isMarkActive } from 'ngx-editor/helpers';

import { SimpleCommand } from './types';
import { applyMark, Command, toggleMark } from 'ngx-editor/commands';

class Mark implements SimpleCommand {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/commands/TextAlign.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EditorState, Transaction } from 'prosemirror-state';
import { Node } from 'prosemirror-model';
import { Command } from 'prosemirror-commands';

import { getSelectionNodes } from 'ngx-editor/helpers';
import { Command } from 'ngx-editor/commands';

export type Align = 'left' | 'center' | 'right' | 'justify';

Expand Down
3 changes: 2 additions & 1 deletion src/lib/commands/TextColor.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { MarkType } from 'prosemirror-model';
import { EditorState } from 'prosemirror-state';
import { Command } from 'prosemirror-commands';

import { getSelectionMarks, isMarkActive } from 'ngx-editor/helpers';
import { applyMark, removeMark, Command } from 'ngx-editor/commands';
import { applyMark, removeMark } from 'ngx-editor/commands';

import { Dispatch } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/lib/commands/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EditorState, Transaction } from 'prosemirror-state';
import { Command } from 'ngx-editor/commands';
import { Command } from 'prosemirror-commands';

export type Dispatch = (tr: Transaction) => void | null;

Expand Down
11 changes: 5 additions & 6 deletions src/lib/defaultPlugins.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { NodeType, Schema } from 'prosemirror-model';
import { Plugin } from 'prosemirror-state';

import { keymap } from 'ngx-editor/keymap';
import { toggleMark, baseKeymap } from 'ngx-editor/commands';
import { splitListItem, liftListItem, sinkListItem } from 'ngx-editor/schema-list';
import { history, undo, redo } from 'ngx-editor/history';
import { keymap } from 'prosemirror-keymap';
import { toggleMark, baseKeymap } from 'prosemirror-commands';
import { splitListItem, liftListItem, sinkListItem } from 'prosemirror-schema-list';
import { history, undo, redo } from 'prosemirror-history';
import {
inputRules, wrappingInputRule, textblockTypeInputRule,
smartQuotes, emDash, ellipsis, InputRule
} from 'ngx-editor/inputrules';
} from 'prosemirror-inputrules';

interface Options {
history: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/schema/nodes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DOMOutputSpec, Node as ProsemirrorNode, NodeSpec } from 'prosemirror-model';
import * as sl from 'ngx-editor/schema-list';
import * as sl from 'prosemirror-schema-list';

import toStyleString from '../utils/toStyleString';

Expand Down
7 changes: 6 additions & 1 deletion src/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
"umdModuleIds": {
"prosemirror-state": "prosemirrorState",
"prosemirror-view": "prosemirrorView",
"prosemirror-model": "prosemirrorModel"
"prosemirror-model": "prosemirrorModel",
"prosemirror-keymap": "prosemirrorKeymap",
"prosemirror-schema-list": "prosemirroSchemaList",
"prosemirror-commands": "prosemirrorCommands",
"prosemirror-history": "prosemirrorHistory",
"prosemirror-inputrules": "prosemirrorInputRules"
}
},
"whitelistedNonPeerDependencies": [
Expand Down
10 changes: 0 additions & 10 deletions src/schema-list/package.json

This file was deleted.

1 change: 0 additions & 1 deletion src/schema-list/public_api.ts

This file was deleted.

0 comments on commit 86a8a82

Please sign in to comment.