prosemirror-codemark
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -1,4 +0,4 @@ | ||
import { MarkType } from 'prosemirror-model'; | ||
import type { MarkType } from 'prosemirror-model'; | ||
import { EditorState, Plugin, Transaction } from 'prosemirror-state'; | ||
import { EditorView } from 'prosemirror-view'; | ||
import type { EditorView } from 'prosemirror-view'; | ||
export declare function stepOutsideNextTrAndPass(view: EditorView, plugin: Plugin, action?: 'click' | 'next'): boolean; | ||
@@ -5,0 +5,0 @@ export declare function onBacktick(view: EditorView, plugin: Plugin, event: KeyboardEvent, markType: MarkType): boolean; |
import { Plugin, Transaction } from 'prosemirror-state'; | ||
import { Options } from './types'; | ||
import type { Options } from './types'; | ||
declare type InputRuleState = { | ||
@@ -4,0 +4,0 @@ transform: Transaction; |
import { Plugin } from 'prosemirror-state'; | ||
import { CodemarkState, Options } from './types'; | ||
import type { CodemarkState, Options } from './types'; | ||
export declare function getDecorationPlugin(opts?: Options): Plugin<CodemarkState, any>; | ||
export declare function codemark(opts?: Options): Plugin<any, any>[]; |
@@ -1,2 +0,2 @@ | ||
import { MarkType } from 'prosemirror-model'; | ||
import type { MarkType } from 'prosemirror-model'; | ||
export declare type Options = { | ||
@@ -3,0 +3,0 @@ markType?: MarkType; |
@@ -1,5 +0,5 @@ | ||
import { MarkType, Node } from 'prosemirror-model'; | ||
import type { MarkType, Node } from 'prosemirror-model'; | ||
import { EditorState, PluginKey } from 'prosemirror-state'; | ||
import { EditorView } from 'prosemirror-view'; | ||
import { Options } from './types'; | ||
import type { EditorView } from 'prosemirror-view'; | ||
import type { Options } from './types'; | ||
export declare const DEFAULT_ID = "codemark"; | ||
@@ -6,0 +6,0 @@ export declare const MAX_MATCH = 100; |
{ | ||
"name": "prosemirror-codemark", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Inline code mark for ProseMirror", | ||
@@ -5,0 +5,0 @@ "author": "Rowan Cockett <rowan@curvenote.com>", |
@@ -34,2 +34,4 @@ # `prosemirror-codemark` | ||
### Basic ProseMirror | ||
To use the plugins, supply your `MarkType` and use the plugins in your `EditorView`. | ||
@@ -51,2 +53,24 @@ | ||
### Usage with [TipTap](https://tiptap.dev) | ||
Create a [TipTap extention](https://tiptap.dev/api/extensions) and add a custom plugin. | ||
The schema can be accessed from `this.editor.schema.marks.code`. | ||
```ts | ||
import codemark from 'prosemirror-codemark'; | ||
import 'codemark/dist/codemark.css'; | ||
const codemarkPlugin = Extension.create({ | ||
name: 'codemarkPlugin', | ||
addProseMirrorPlugins() { | ||
return codemark({ markType: this.editor.schema.marks.code }); | ||
}, | ||
}); | ||
this.editor = new Editor({ | ||
extensions: [StarterKit, codemarkPlugin], | ||
content: `This is a <code>code</code> test!`, | ||
}); | ||
``` | ||
The styles are necessary to show the `.fake-cursor`, they are simple if you want to [override them](./src/codemark.css). It does not provide styles for the `code` specifically. The plugin visually works best if the code mark has a border and a different color than the main text. | ||
@@ -53,0 +77,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58699
177