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

draftmirror

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

draftmirror - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

25

lib/editor.js

@@ -72,5 +72,15 @@ var React = require('react');

* Update keymaps
* todo: update on componentWillReceiveProps
*/
updateKeymaps: function(newProps) {
updateKeymaps: function(newProps, forceUpdate) {
if (!forceUpdate && Immutable.is(newProps.keymaps, this.props.keymaps)) {
return;
}
// Unbind old ones
Immutable.List(this.props.keymaps)
.forEach(function(keymap) {
keymap.unbindToEditor(this.editor);
}, this);
// Bind new ones
Immutable.List(newProps.keymaps)

@@ -83,6 +93,6 @@ .forEach(function(keymap) {

/**
* Updateinput rules
* Update input rules
*/
updateInputRules: function(newProps) {
if (Immutable.is(newProps.inputRules, this.props.inputRules)) {
updateInputRules: function(newProps, forceUpdate) {
if (!forceUpdate && Immutable.is(newProps.inputRules, this.props.inputRules)) {
return;

@@ -128,4 +138,4 @@ }

this.updateKeymaps(newProps);
this.updateInputRules(newProps);
this.updateKeymaps(newProps, true);
this.updateInputRules(newProps, true);
},

@@ -157,2 +167,3 @@

this.updateKeymaps(newProps);
this.updateInputRules(newProps);

@@ -159,0 +170,0 @@

@@ -27,2 +27,10 @@ var Immutable = require('immutable');

/**
* Unbind a keymap from an editor
* @param {ProseMirror} editor
*/
Keymap.prototype.unbindToEditor = function(editor) {
editor.removeKeymap(this.getMap());
};
/**
* Add a set of keys

@@ -29,0 +37,0 @@ * @param {Object} keys

@@ -48,6 +48,6 @@ var is = require('is');

*/
function insertTab(editor, apply) {
function insertTab(defaultIndent, editor, apply) {
return insertInCode(editor, function(node) {
var nodeText = node.textContent;
return detectIndent(nodeText).indent || ' ';
return detectIndent(nodeText).indent || defaultIndent;
}, apply);

@@ -60,7 +60,9 @@ }

*/
function createKeymap(priority) {
function createKeymap(priority, defaultIndent) {
defaultIndent = defaultIndent || ' ';
return Keymap.create({
'Enter': commands.newlineInCode,
'Shift-Enter': insertNewLine,
'Tab': insertTab
'Tab': insertTab.bind(null, defaultIndent)
}, priority);

@@ -67,0 +69,0 @@ }

{
"name": "draftmirror",
"version": "0.5.2",
"version": "0.5.3",
"description": "React component for ProseMirror providing a Draft.js like API",

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

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