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

@blocknote/core

Package Overview
Dependencies
Maintainers
2
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocknote/core - npm Package Compare versions

Comparing version 0.9.4 to 0.9.5

4

package.json

@@ -6,3 +6,3 @@ {

"license": "MPL-2.0",
"version": "0.9.4",
"version": "0.9.5",
"files": [

@@ -113,3 +113,3 @@ "dist",

},
"gitHead": "31e3c53bdcc082e3793bbb5517462cc18abd9e22"
"gitHead": "d1720576466e2d32ebbfaff43a7a5e6f6333a600"
}

@@ -41,3 +41,35 @@ import { Attribute, Attributes, Node } from "@tiptap/core";

// attribute for it.
parseHTML: (element) => element.getAttribute(camelToDataKebab(name)),
parseHTML: (element) => {
const value = element.getAttribute(camelToDataKebab(name));
if (value === null) {
return null;
}
if (typeof spec.default === "boolean") {
if (value === "true") {
return true;
}
if (value === "false") {
return false;
}
return null;
}
if (typeof spec.default === "number") {
const asNumber = parseFloat(value);
const isNumeric =
!Number.isNaN(asNumber) && Number.isFinite(asNumber);
if (isNumeric) {
return asNumber;
}
return null;
}
return value;
},
renderHTML: (attributes) =>

@@ -44,0 +76,0 @@ attributes[name] !== spec.default

@@ -488,2 +488,47 @@ import { mergeAttributes, Node } from "@tiptap/core";

const handleDelete = () =>
this.editor.commands.first(({ commands }) => [
// Deletes the selection if it's not empty.
() => commands.deleteSelection(),
// Merges block with the next one (at the same nesting level or lower),
// if one exists, the block has no children, and the selection is at the
// end of the block.
() =>
commands.command(({ state }) => {
const { node, contentNode, depth, endPos } = getBlockInfoFromPos(
state.doc,
state.selection.from
)!;
const blockAtDocEnd = false;
const selectionAtBlockEnd =
state.selection.$anchor.parentOffset ===
contentNode.firstChild!.nodeSize;
const selectionEmpty =
state.selection.anchor === state.selection.head;
const hasChildBlocks = node.childCount === 2;
if (
!blockAtDocEnd &&
selectionAtBlockEnd &&
selectionEmpty &&
!hasChildBlocks
) {
let oldDepth = depth;
let newPos = endPos + 2;
let newDepth = state.doc.resolve(newPos).depth;
while (newDepth < oldDepth) {
oldDepth = newDepth;
newPos += 2;
newDepth = state.doc.resolve(newPos).depth;
}
return commands.BNMergeBlocks(newPos - 1);
}
return false;
}),
]);
const handleEnter = () =>

@@ -556,2 +601,4 @@ this.editor.commands.first(({ commands }) => [

const selectionAtBlockStart =
state.selection.$anchor.parentOffset === 0;
const blockEmpty = node.textContent.length === 0;

@@ -562,3 +609,3 @@

.deleteSelection()
.BNSplitBlock(state.selection.from, false)
.BNSplitBlock(state.selection.from, selectionAtBlockStart)
.run();

@@ -575,2 +622,3 @@

Backspace: handleBackspace,
Delete: handleDelete,
Enter: handleEnter,

@@ -577,0 +625,0 @@ // Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the

@@ -349,2 +349,6 @@ import { EditorState, Plugin, PluginKey } from "prosemirror-state";

if (event.key === "Enter") {
if (items.length === 0) {
return true;
}
deactivate(view);

@@ -351,0 +355,0 @@ editor._tiptapEditor

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 not supported yet

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