mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-25 09:43:21 +01:00
Merge branch 'master' into remove-normalize
This commit is contained in:
commit
7d9620d707
@ -89,7 +89,7 @@ Transform methods can either operate on the [`Document`](./document.md), the [`S
|
||||
|
||||
Applies all of the current transform steps, returning the newly transformed [`State`](./state.md). An `options` object is optional, containing values of:
|
||||
|
||||
- `snapshot: Boolean` — override the editor's built-in logic of whether to create a new snapshot in the history, that can be reverted to later.
|
||||
- `save: Boolean` — override the editor's built-in logic of whether to create a new snapshot in the history, that can be reverted to later.
|
||||
|
||||
|
||||
## Current State Transforms
|
||||
|
@ -128,7 +128,7 @@ class Images extends React.Component {
|
||||
data: {}
|
||||
})
|
||||
.apply({
|
||||
snapshot: false
|
||||
save: false
|
||||
})
|
||||
|
||||
this.onChange(normalized)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "slate",
|
||||
"description": "A completely customizable framework for building rich text editors.",
|
||||
"version": "0.14.13",
|
||||
"version": "0.14.15",
|
||||
"license": "MIT",
|
||||
"repository": "git://github.com/ianstormtaylor/slate.git",
|
||||
"main": "./lib/index.js",
|
||||
@ -87,6 +87,7 @@
|
||||
"lint": "eslint --ignore-pattern 'build.dev.js' --ignore-pattern 'build.prod.js' '{examples,src}/**/*.js'",
|
||||
"open": "open http://localhost:8080/dev.html",
|
||||
"prepublish": "npm run build",
|
||||
"postpublish": "npm run gh-pages",
|
||||
"release": "np",
|
||||
"release:next": "np --tag=next",
|
||||
"start": "http-server ./examples",
|
||||
|
@ -67,8 +67,7 @@ class Void extends React.Component {
|
||||
|
||||
// Make the outer wrapper relative, so the spacer can overlay it.
|
||||
const style = {
|
||||
position: 'relative',
|
||||
lineHeight: '0px'
|
||||
position: 'relative'
|
||||
}
|
||||
|
||||
return (
|
||||
@ -91,11 +90,31 @@ class Void extends React.Component {
|
||||
*/
|
||||
|
||||
renderSpacer = () => {
|
||||
const style = {
|
||||
position: 'relative',
|
||||
top: '0px',
|
||||
left: '-9999px',
|
||||
textIndent: '-9999px',
|
||||
const { node } = this.props
|
||||
let style
|
||||
|
||||
if (node.kind == 'block') {
|
||||
style = IS_FIREFOX
|
||||
? {
|
||||
pointerEvents: 'none',
|
||||
width: '0px',
|
||||
height: '0px',
|
||||
lineHeight: '0px',
|
||||
visibility: 'hidden'
|
||||
}
|
||||
: {
|
||||
position: 'absolute',
|
||||
top: '0px',
|
||||
left: '-9999px',
|
||||
textIndent: '-9999px'
|
||||
}
|
||||
} else {
|
||||
style = {
|
||||
position: 'relative',
|
||||
top: '0px',
|
||||
left: '-9999px',
|
||||
textIndent: '-9999px',
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -429,7 +429,7 @@ class State extends new Record(DEFAULTS) {
|
||||
rule.normalize(transform, document, value)
|
||||
}
|
||||
|
||||
return transform.apply({ snapshot: false })
|
||||
return transform.apply({ save: false })
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,6 +6,7 @@ import Placeholder from '../components/placeholder'
|
||||
import React from 'react'
|
||||
import String from '../utils/string'
|
||||
import getWindow from 'get-window'
|
||||
import { IS_MAC } from '../constants/environment'
|
||||
|
||||
/**
|
||||
* Debug.
|
||||
@ -337,6 +338,7 @@ function Plugin(options = {}) {
|
||||
case 'right': return onKeyDownRight(e, data, state)
|
||||
case 'y': return onKeyDownY(e, data, state)
|
||||
case 'z': return onKeyDownZ(e, data, state)
|
||||
case 'k': return onKeyDownK(e, data, state)
|
||||
}
|
||||
}
|
||||
|
||||
@ -573,6 +575,28 @@ function Plugin(options = {}) {
|
||||
.apply({ save: false })
|
||||
}
|
||||
|
||||
/**
|
||||
* On `k` key down, delete untill the end of the line (mac only)
|
||||
*
|
||||
* @param {Event} e
|
||||
* @param {Object} data
|
||||
* @param {State} state
|
||||
* @return {State}
|
||||
*/
|
||||
|
||||
function onKeyDownK(e, data, state) {
|
||||
if (!IS_MAC || !data.isCtrl) return
|
||||
|
||||
debug('onKeyDownK', { data })
|
||||
|
||||
const { startOffset, startBlock } = state
|
||||
|
||||
return state
|
||||
.transform()
|
||||
.deleteForward(startBlock.text.length - startOffset)
|
||||
.apply()
|
||||
}
|
||||
|
||||
/**
|
||||
* On paste.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
<div contenteditable="true">
|
||||
<div style="position:relative;line-height:0px;">
|
||||
<span style="position:relative;top:0px;left:-9999px;text-indent:-9999px;">
|
||||
<div style="position:relative;">
|
||||
<span style="position:absolute;top:0px;left:-9999px;text-indent:-9999px;">
|
||||
<span>
|
||||
<span class="slate-zero-width-space">​</span>
|
||||
</span>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<span class="slate-zero-width-space">​</span>
|
||||
</span>
|
||||
</span>
|
||||
<span style="position:relative;line-height:0px;">
|
||||
<span style="position:relative;">
|
||||
<span style="position:relative;top:0px;left:-9999px;text-indent:-9999px;">
|
||||
<span>
|
||||
<span class="slate-zero-width-space">​</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user