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

prosemirror-tables

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-tables - npm Package Compare versions

Comparing version 0.7.2 to 0.7.3

demo_bundle.js

2

package.json
{
"name": "prosemirror-tables",
"version": "0.7.2",
"version": "0.7.3",
"description": "ProseMirror's rowspan/colspan tables component",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -10,2 +10,3 @@ // This file defines a number of table-related commands.

import {tableNodeTypes} from "./schema"
import {cellWrapping, cellAround} from './util'

@@ -279,5 +280,13 @@ // Helper to get the selected rectangle in a table, if any. Adds table

let sel = state.selection
if (!(sel instanceof CellSelection) || sel.$anchorCell.pos != sel.$headCell.pos) return false
let cellNode = sel.$anchorCell.nodeAfter
if (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) return false
let cellNode, cellPos
if (!(sel instanceof CellSelection)) {
cellNode = cellWrapping(sel.$from)
if (!cellNode) return false
cellPos = cellAround(sel.$from).pos
} else {
if (sel.$anchorCell.pos != sel.$headCell.pos) return false
cellNode = sel.$anchorCell.nodeAfter
cellPos = sel.$anchorCell.pos
}
if (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) {return false}
if (dispatch) {

@@ -301,5 +310,6 @@ let baseAttrs = cellNode.attrs, attrs = [], colwidth = baseAttrs.colwidth

}
tr.setNodeMarkup(sel.$anchorCell.pos, null, attrs[0])
tr.setSelection(new CellSelection(tr.doc.resolve(sel.$anchorCell.pos),
lastCell && tr.doc.resolve(lastCell)))
tr.setNodeMarkup(cellPos, null, attrs[0])
if (sel instanceof CellSelection)
tr.setSelection(new CellSelection(tr.doc.resolve(sel.$anchorCell.pos),
lastCell && tr.doc.resolve(lastCell)))
dispatch(tr)

@@ -306,0 +316,0 @@ }

@@ -15,2 +15,8 @@ // Various helper function for working with tables

export function cellWrapping($pos) {
for (var d = $pos.depth - 1; d > 0; d--)
if ($pos.node(d).type.spec.tableRole == "cell") return $pos.node(d)
return null
}
export function isInTable(state) {

@@ -17,0 +23,0 @@ let $head = state.selection.$head

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