@tiptap/core
Advanced tools
Comparing version 2.0.0-alpha.11 to 2.0.0-alpha.12
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-alpha.12](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-alpha.11...@tiptap/core@2.0.0-alpha.12) (2021-01-28) | ||
**Note:** Version bump only for package @tiptap/core | ||
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-alpha.10...@tiptap/core@2.0.0-alpha.11) (2021-01-28) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@tiptap/core", | ||
"description": "headless rich text editor", | ||
"version": "2.0.0-alpha.11", | ||
"version": "2.0.0-alpha.12", | ||
"homepage": "https://tiptap.dev", | ||
@@ -46,3 +46,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "bca182a9d99681f002009c021a1aa6e494114f4b" | ||
"gitHead": "a9c14fbddd6b419b045e3494f89f6f1cf206bc42" | ||
} |
@@ -15,3 +15,11 @@ import { EditorState, Plugin, Transaction } from 'prosemirror-state' | ||
import EventEmitter from './EventEmitter' | ||
import { EditorOptions, EditorContent, CommandSpec } from './types' | ||
import { | ||
EditorOptions, | ||
EditorContent, | ||
CommandSpec, | ||
CanCommands, | ||
ChainedCommands, | ||
SingleCommands, | ||
AnyObject, | ||
} from './types' | ||
import * as extensions from './extensions' | ||
@@ -72,3 +80,3 @@ import style from './style' | ||
*/ | ||
private init() { | ||
private init(): void { | ||
this.createCommandManager() | ||
@@ -106,3 +114,3 @@ this.createExtensionManager() | ||
*/ | ||
public get commands() { | ||
public get commands(): SingleCommands { | ||
return this.commandManager.createCommands() | ||
@@ -114,3 +122,3 @@ } | ||
*/ | ||
public chain() { | ||
public chain(): ChainedCommands { | ||
return this.commandManager.createChain() | ||
@@ -122,3 +130,3 @@ } | ||
*/ | ||
public can() { | ||
public can(): CanCommands { | ||
return this.commandManager.createCan() | ||
@@ -130,3 +138,3 @@ } | ||
*/ | ||
private injectCSS() { | ||
private injectCSS(): void { | ||
if (this.options.injectCSS && document) { | ||
@@ -142,3 +150,3 @@ this.css = createStyleTag(style) | ||
*/ | ||
public setOptions(options: Partial<EditorOptions> = {}) { | ||
public setOptions(options: Partial<EditorOptions> = {}): void { | ||
this.options = { ...this.options, ...options } | ||
@@ -154,3 +162,3 @@ | ||
*/ | ||
public get isEditable() { | ||
public get isEditable(): boolean { | ||
return this.view && this.view.editable | ||
@@ -162,3 +170,3 @@ } | ||
*/ | ||
public get state() { | ||
public get state(): EditorState { | ||
return this.view.state | ||
@@ -172,3 +180,3 @@ } | ||
*/ | ||
public registerCommands(commands: { [key: string]: CommandSpec }) { | ||
public registerCommands(commands: { [key: string]: CommandSpec }): void { | ||
Object | ||
@@ -197,3 +205,3 @@ .entries(commands) | ||
*/ | ||
public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]) { | ||
public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void { | ||
const plugins = typeof handlePlugins === 'function' | ||
@@ -213,3 +221,3 @@ ? handlePlugins(plugin, this.state.plugins) | ||
*/ | ||
public unregisterPlugin(name: string) { | ||
public unregisterPlugin(name: string): void { | ||
const state = this.state.reconfigure({ | ||
@@ -226,3 +234,3 @@ // @ts-ignore | ||
*/ | ||
private createExtensionManager() { | ||
private createExtensionManager(): void { | ||
const coreExtensions = Object.entries(extensions).map(([, extension]) => extension) | ||
@@ -239,3 +247,3 @@ const allExtensions = [...this.options.extensions, ...coreExtensions].filter(extension => { | ||
*/ | ||
private createCommandManager() { | ||
private createCommandManager(): void { | ||
this.commandManager = new CommandManager(this.proxy) | ||
@@ -247,3 +255,3 @@ } | ||
*/ | ||
private createSchema() { | ||
private createSchema(): void { | ||
this.schema = this.extensionManager.schema | ||
@@ -255,3 +263,3 @@ } | ||
*/ | ||
private createView() { | ||
private createView(): void { | ||
this.view = new EditorView(this.options.element, { | ||
@@ -284,3 +292,3 @@ ...this.options.editorProps, | ||
*/ | ||
public createNodeViews() { | ||
public createNodeViews(): void { | ||
this.view.setProps({ | ||
@@ -324,3 +332,3 @@ nodeViews: this.extensionManager.nodeViews, | ||
*/ | ||
private dispatchTransaction(transaction: Transaction) { | ||
private dispatchTransaction(transaction: Transaction): void { | ||
const state = this.state.apply(transaction) | ||
@@ -359,3 +367,3 @@ const selectionHasChanged = !this.state.selection.eq(state.selection) | ||
*/ | ||
public getNodeAttributes(name: string) { | ||
public getNodeAttributes(name: string): AnyObject { | ||
return getNodeAttributes(this.state, name) | ||
@@ -369,3 +377,3 @@ } | ||
*/ | ||
public getMarkAttributes(name: string) { | ||
public getMarkAttributes(name: string): AnyObject { | ||
return getMarkAttributes(this.state, name) | ||
@@ -397,3 +405,3 @@ } | ||
*/ | ||
public getJSON() { | ||
public getJSON(): AnyObject { | ||
return this.state.doc.toJSON() | ||
@@ -405,3 +413,3 @@ } | ||
*/ | ||
public getHTML() { | ||
public getHTML(): string { | ||
return getHTMLFromFragment(this.state.doc, this.schema) | ||
@@ -413,3 +421,3 @@ } | ||
*/ | ||
public isEmpty() { | ||
public isEmpty(): boolean { | ||
const defaultContent = this.state.doc.type.createAndFill()?.toJSON() | ||
@@ -424,3 +432,3 @@ const content = this.getJSON() | ||
*/ | ||
public getCharacterCount() { | ||
public getCharacterCount(): number { | ||
return this.state.doc.content.size - 2 | ||
@@ -432,3 +440,3 @@ } | ||
*/ | ||
public destroy() { | ||
public destroy(): void { | ||
this.emit('destroy') | ||
@@ -447,3 +455,3 @@ | ||
*/ | ||
private get isDestroyed() { | ||
private get isDestroyed(): boolean { | ||
// @ts-ignore | ||
@@ -450,0 +458,0 @@ return !this.view?.docView |
@@ -5,2 +5,3 @@ import { keymap } from 'prosemirror-keymap' | ||
import { EditorView, Decoration } from 'prosemirror-view' | ||
import { Plugin } from 'prosemirror-state' | ||
import { Editor } from './Editor' | ||
@@ -69,3 +70,3 @@ import { Extensions, NodeViewRenderer } from './types' | ||
get plugins() { | ||
get plugins(): Plugin[] { | ||
return this.extensions | ||
@@ -72,0 +73,0 @@ .map(extension => { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2333132
212
13480