Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tiptap/core

Package Overview
Dependencies
Maintainers
2
Versions
330
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/core - npm Package Compare versions

Comparing version 2.0.0-alpha.18 to 2.0.0-alpha.19

dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [2.0.0-alpha.19](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-alpha.18...@tiptap/core@2.0.0-alpha.19) (2021-02-18)
**Note:** Version bump only for package @tiptap/core
# [2.0.0-alpha.18](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-alpha.17...@tiptap/core@2.0.0-alpha.18) (2021-02-16)

@@ -8,0 +16,0 @@

import { Extension } from '../Extension';
import * as blur from '../commands/blur';
import * as clearContent from '../commands/clearContent';
import * as clearNodes from '../commands/clearNodes';
import * as command from '../commands/command';
import * as createParagraphNear from '../commands/createParagraphNear';
import * as deleteRange from '../commands/deleteRange';
import * as deleteSelection from '../commands/deleteSelection';
import * as enter from '../commands/enter';
import * as exitCode from '../commands/exitCode';
import * as extendMarkRange from '../commands/extendMarkRange';
import * as first from '../commands/first';
import * as focus from '../commands/focus';
import * as insertHTML from '../commands/insertHTML';
import * as insertText from '../commands/insertText';
import * as joinBackward from '../commands/joinBackward';
import * as joinForward from '../commands/joinForward';
import * as keyboardShortcut from '../commands/keyboardShortcut';
import * as lift from '../commands/lift';
import * as liftEmptyBlock from '../commands/liftEmptyBlock';
import * as liftListItem from '../commands/liftListItem';
import * as newlineInCode from '../commands/newlineInCode';
import * as replace from '../commands/replace';
import * as replaceRange from '../commands/replaceRange';
import * as resetNodeAttributes from '../commands/resetNodeAttributes';
import * as scrollIntoView from '../commands/scrollIntoView';
import * as selectAll from '../commands/selectAll';
import * as selectNodeBackward from '../commands/selectNodeBackward';
import * as selectNodeForward from '../commands/selectNodeForward';
import * as selectParentNode from '../commands/selectParentNode';
import * as setContent from '../commands/setContent';
import * as setMark from '../commands/setMark';
import * as setNode from '../commands/setNode';
import * as sinkListItem from '../commands/sinkListItem';
import * as splitBlock from '../commands/splitBlock';
import * as splitListItem from '../commands/splitListItem';
import * as toggleList from '../commands/toggleList';
import * as toggleMark from '../commands/toggleMark';
import * as toggleNode from '../commands/toggleNode';
import * as toggleWrap from '../commands/toggleWrap';
import * as undoInputRule from '../commands/undoInputRule';
import * as unsetAllMarks from '../commands/unsetAllMarks';
import * as unsetMark from '../commands/unsetMark';
import * as updateNodeAttributes from '../commands/updateNodeAttributes';
import * as wrapIn from '../commands/wrapIn';
import * as wrapInList from '../commands/wrapInList';
export { blur };
export { clearContent };
export { clearNodes };
export { command };
export { createParagraphNear };
export { deleteRange };
export { deleteSelection };
export { enter };
export { exitCode };
export { extendMarkRange };
export { first };
export { focus };
export { insertHTML };
export { insertText };
export { joinBackward };
export { joinForward };
export { keyboardShortcut };
export { lift };
export { liftEmptyBlock };
export { liftListItem };
export { newlineInCode };
export { replace };
export { replaceRange };
export { resetNodeAttributes };
export { scrollIntoView };
export { selectAll };
export { selectNodeBackward };
export { selectNodeForward };
export { selectParentNode };
export { setContent };
export { setMark };
export { setNode };
export { sinkListItem };
export { splitBlock };
export { splitListItem };
export { toggleList };
export { toggleMark };
export { toggleNode };
export { toggleWrap };
export { undoInputRule };
export { unsetAllMarks };
export { unsetMark };
export { updateNodeAttributes };
export { wrapIn };
export { wrapInList };
export declare const Commands: Extension<unknown>;

5

package.json
{
"name": "@tiptap/core",
"description": "headless rich text editor",
"version": "2.0.0-alpha.18",
"version": "2.0.0-alpha.19",
"homepage": "https://tiptap.dev",

@@ -45,3 +45,4 @@ "keywords": [

"prosemirror-view": "^1.17.6"
}
},
"gitHead": "f6a20d2b6e71304d2c19a12c729b2d9efb00c4b4"
}

2

src/commands/focus.ts

@@ -70,2 +70,4 @@ import { EditorState, TextSelection } from 'prosemirror-state'

// `tr.setSelection` resets the stored marks
// so we’ll restore them if the selection is the same as before
if (isSameSelection && storedMarks) {

@@ -72,0 +74,0 @@ tr.setStoredMarks(storedMarks)

import { DOMParser } from 'prosemirror-model'
import { Selection, Transaction } from 'prosemirror-state'
import { ReplaceStep, ReplaceAroundStep } from 'prosemirror-transform'
import elementFromString from '../utilities/elementFromString'
import selectionToInsertionEnd from '../helpers/selectionToInsertionEnd'
import { Command, RawCommands } from '../types'
// TODO: move to utils
// https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.js#L466
function selectionToInsertionEnd(tr: Transaction, startLen: number, bias: number) {
const last = tr.steps.length - 1
if (last < startLen) return
const step = tr.steps[last]
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) return
const map = tr.mapping.maps[last]
let end = 0
map.forEach((_from, _to, _newFrom, newTo) => { if (end === 0) end = newTo })
tr.setSelection(Selection.near(tr.doc.resolve(end as unknown as number), bias))
}
declare module '@tiptap/core' {

@@ -21,0 +7,0 @@ interface Commands {

@@ -48,2 +48,48 @@ import { Extension } from '../Extension'

export { blur }
export { clearContent }
export { clearNodes }
export { command }
export { createParagraphNear }
export { deleteRange }
export { deleteSelection }
export { enter }
export { exitCode }
export { extendMarkRange }
export { first }
export { focus }
export { insertHTML }
export { insertText }
export { joinBackward }
export { joinForward }
export { keyboardShortcut }
export { lift }
export { liftEmptyBlock }
export { liftListItem }
export { newlineInCode }
export { replace }
export { replaceRange }
export { resetNodeAttributes }
export { scrollIntoView }
export { selectAll }
export { selectNodeBackward }
export { selectNodeForward }
export { selectParentNode }
export { setContent }
export { setMark }
export { setNode }
export { sinkListItem }
export { splitBlock }
export { splitListItem }
export { toggleList }
export { toggleMark }
export { toggleNode }
export { toggleWrap }
export { undoInputRule }
export { unsetAllMarks }
export { unsetMark }
export { updateNodeAttributes }
export { wrapIn }
export { wrapInList }
export const Commands = Extension.create({

@@ -50,0 +96,0 @@ name: 'commands',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc