1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 10:29:48 +02:00

Remove a most of unused vars

This commit is contained in:
Soreine
2016-10-25 13:12:00 +02:00
parent e81708e82f
commit ce0a5579e7
30 changed files with 21 additions and 66 deletions

View File

@@ -122,8 +122,7 @@ class AutoMarkdown extends React.Component {
onSpace = (e, state) => { onSpace = (e, state) => {
if (state.isExpanded) return if (state.isExpanded) return
let { selection } = state const { startBlock, startOffset } = state
const { startText, startBlock, startOffset } = state
const chars = startBlock.text.slice(0, startOffset).replace(/\s*/g, '') const chars = startBlock.text.slice(0, startOffset).replace(/\s*/g, '')
const type = this.getType(chars) const type = this.getType(chars)

View File

@@ -1,5 +1,5 @@
import { Editor, Mark, Raw, Selection } from '../..' import { Editor, Mark, Raw } from '../..'
import Prism from 'prismjs' import Prism from 'prismjs'
import React from 'react' import React from 'react'
import initialState from './state.json' import initialState from './state.json'
@@ -12,7 +12,7 @@ import initialState from './state.json'
*/ */
function CodeBlock(props) { function CodeBlock(props) {
const { attributes, children, editor, node } = props const { editor, node } = props
const language = node.data.get('language') const language = node.data.get('language')
function onChange(e) { function onChange(e) {

View File

@@ -1,5 +1,5 @@
import { Editor, Mark, Raw } from '../../..' import { Editor, Raw } from '../../..'
import React from 'react' import React from 'react'
import initialState from './state.json' import initialState from './state.json'

View File

@@ -1,7 +1,6 @@
import { Editor, Raw } from '../..' import { Editor, Raw } from '../..'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom'
import Video from './video' import Video from './video'
import initialState from './state.json' import initialState from './state.json'

View File

@@ -17,7 +17,7 @@ class Video extends React.Component {
onChange = (e) => { onChange = (e) => {
const video = e.target.value const video = e.target.value
const { node, state, editor } = this.props const { node, editor } = this.props
const properties = { const properties = {
data: { video } data: { video }
} }
@@ -90,7 +90,7 @@ class Video extends React.Component {
src={video} src={video}
frameBorder="0" frameBorder="0"
style={iframeStyle} style={iframeStyle}
></iframe> />
</div> </div>
) )
} }

View File

@@ -1,11 +1,7 @@
import { Editor, Mark, Raw } from '../..' import { Editor, Raw } from '../..'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom'
import initialState from './state.json' import initialState from './state.json'
import isUrl from 'is-url'
import { Map } from 'immutable'
const EMOJIS = [ const EMOJIS = [
'😃', '😬', '🍔' '😃', '😬', '🍔'

View File

@@ -1,5 +1,5 @@
import { Editor, Mark, Raw } from '../..' import { Editor, Raw } from '../..'
import Portal from 'react-portal' import Portal from 'react-portal'
import React from 'react' import React from 'react'
import position from 'selection-position' import position from 'selection-position'
@@ -123,8 +123,6 @@ class HoveringMenu extends React.Component {
*/ */
renderMenu = () => { renderMenu = () => {
const { state } = this.state
const isOpen = state.isExpanded && state.isFocused
return ( return (
<Portal isOpened onOpen={this.onOpen}> <Portal isOpened onOpen={this.onOpen}>
<div className="menu hover-menu"> <div className="menu hover-menu">

View File

@@ -1,8 +1,7 @@
import { Editor, Mark, Raw } from '../..' import { Editor, Raw } from '../..'
import Frame from 'react-frame-component' import Frame from 'react-frame-component'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom'
import initialState from './state.json' import initialState from './state.json'
/** /**
@@ -176,7 +175,7 @@ class Iframes extends React.Component {
rel="stylesheet" rel="stylesheet"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossOrigin="anonymous" crossOrigin="anonymous"
></link> />
) )
const style = { const style = {
@@ -233,7 +232,7 @@ class Iframes extends React.Component {
return ( return (
<button className={className} onMouseDown={onMouseDown}> <button className={className} onMouseDown={onMouseDown}>
<span className={`glyphicon glyphicon-${icon}`}></span> <span className={`glyphicon glyphicon-${icon}`} />
</button> </button>
) )
} }
@@ -254,7 +253,7 @@ class Iframes extends React.Component {
return ( return (
<button className={className} onMouseDown={onMouseDown}> <button className={className} onMouseDown={onMouseDown}>
<span className={`glyphicon glyphicon-${icon}`}></span> <span className={`glyphicon glyphicon-${icon}`} />
</button> </button>
) )
} }

View File

@@ -1,7 +1,6 @@
import { Editor, Raw, Void } from '../..' import { Editor, Raw } from '../..'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom'
import initialState from './state.json' import initialState from './state.json'
import isImage from 'is-image' import isImage from 'is-image'
import isUrl from 'is-url' import isUrl from 'is-url'

View File

@@ -1,10 +1,8 @@
import { Editor, Mark, Raw } from '../..' import { Editor, Raw } from '../..'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom'
import initialState from './state.json' import initialState from './state.json'
import isUrl from 'is-url' import isUrl from 'is-url'
import { Map } from 'immutable'
/** /**
* Define a schema. * Define a schema.

View File

@@ -1,5 +1,5 @@
import { Editor, Mark, Raw } from '../..' import { Editor, Raw } from '../..'
import React from 'react' import React from 'react'
import initialState from './state.json' import initialState from './state.json'

View File

@@ -1,7 +1,6 @@
import { Editor, Raw } from '../..' import { Editor, Raw } from '../..'
import React from 'react' import React from 'react'
import SoftBreak from 'slate-soft-break'
import initialState from './state.json' import initialState from './state.json'
/** /**

View File

@@ -2,7 +2,6 @@
import { Editor, Raw } from '../..' import { Editor, Raw } from '../..'
import React from 'react' import React from 'react'
import initialState from './state.json' import initialState from './state.json'
import keycode from 'keycode'
/** /**
* Define a schema. * Define a schema.

View File

@@ -8,7 +8,6 @@ import Selection from '../models/selection'
import Transfer from '../utils/transfer' import Transfer from '../utils/transfer'
import TYPES from '../constants/types' import TYPES from '../constants/types'
import getWindow from 'get-window' import getWindow from 'get-window'
import includes from 'lodash/includes'
import keycode from 'keycode' import keycode from 'keycode'
import { IS_FIREFOX, IS_MAC } from '../constants/environment' import { IS_FIREFOX, IS_MAC } from '../constants/environment'
@@ -366,7 +365,6 @@ class Content extends React.Component {
const window = getWindow(e.target) const window = getWindow(e.target)
const { state } = this.props const { state } = this.props
const { selection } = state
const { dataTransfer, x, y } = e.nativeEvent const { dataTransfer, x, y } = e.nativeEvent
const transfer = new Transfer(dataTransfer) const transfer = new Transfer(dataTransfer)
const data = transfer.getData() const data = transfer.getData()
@@ -425,7 +423,7 @@ class Content extends React.Component {
// Get the selection point. // Get the selection point.
const native = window.getSelection() const native = window.getSelection()
const { anchorNode, anchorOffset, focusOffset } = native const { anchorNode, anchorOffset } = native
const point = this.getPoint(anchorNode, anchorOffset) const point = this.getPoint(anchorNode, anchorOffset)
const { key, index, start, end } = point const { key, index, start, end } = point

View File

@@ -4,9 +4,6 @@ import CorePlugin from '../plugins/core'
import Debug from 'debug' import Debug from 'debug'
import React from 'react' import React from 'react'
import Schema from '../models/schema' import Schema from '../models/schema'
import State from '../models/state'
import isReactComponent from '../utils/is-react-component'
import typeOf from 'type-of'
/** /**
* Debug. * Debug.

View File

@@ -306,7 +306,7 @@ class Node extends React.Component {
const ranges = node.getRanges(decorators) const ranges = node.getRanges(decorators)
let offset = 0 let offset = 0
const leaves = ranges.map((range, i, original) => { const leaves = ranges.map((range, i) => {
const leaf = this.renderLeaf(ranges, range, i, offset) const leaf = this.renderLeaf(ranges, range, i, offset)
offset += range.text.length offset += range.text.length
return leaf return leaf

View File

@@ -3,8 +3,6 @@ import Leaf from './leaf'
import Mark from '../models/mark' import Mark from '../models/mark'
import OffsetKey from '../utils/offset-key' import OffsetKey from '../utils/offset-key'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom'
import keycode from 'keycode'
import { IS_FIREFOX } from '../constants/environment' import { IS_FIREFOX } from '../constants/environment'
/** /**

View File

@@ -15,7 +15,7 @@ import Inline from './inline'
import Node from './node' import Node from './node'
import Text from './text' import Text from './text'
import uid from '../utils/uid' import uid from '../utils/uid'
import Immutable, { Map, List, Record } from 'immutable' import { Map, List, Record } from 'immutable'
/** /**
* Default properties. * Default properties.

View File

@@ -1,19 +1,14 @@
import Block from './block' import Block from './block'
import Character from './character' import Character from './character'
import Data from './data'
import Document from './document' import Document from './document'
import Inline from './inline'
import Mark from './mark' import Mark from './mark'
import Normalize from '../utils/normalize' import Normalize from '../utils/normalize'
import Selection from './selection'
import Text from './text'
import direction from 'direction' import direction from 'direction'
import isInRange from '../utils/is-in-range' import isInRange from '../utils/is-in-range'
import includes from 'lodash/includes'
import memoize from '../utils/memoize' import memoize from '../utils/memoize'
import uid from '../utils/uid' import uid from '../utils/uid'
import { List, Map, OrderedSet, Set } from 'immutable' import { List, Set } from 'immutable'
/** /**
@@ -621,7 +616,6 @@ const Node = {
// If the range is collapsed at the start of the node, check the previous. // If the range is collapsed at the start of the node, check the previous.
if (range.isCollapsed && startOffset == 0) { if (range.isCollapsed && startOffset == 0) {
const text = this.getDescendant(startKey)
const previous = this.getPreviousText(startKey) const previous = this.getPreviousText(startKey)
if (!previous || !previous.length) return marks if (!previous || !previous.length) return marks
const char = previous.characters.get(previous.length - 1) const char = previous.characters.get(previous.length - 1)

View File

@@ -2,7 +2,6 @@
import React from 'react' import React from 'react'
import isReactComponent from '../utils/is-react-component' import isReactComponent from '../utils/is-react-component'
import typeOf from 'type-of' import typeOf from 'type-of'
import memoize from '../utils/memoize'
import { Record } from 'immutable' import { Record } from 'immutable'
/** /**

View File

@@ -1,5 +1,4 @@
import includes from 'lodash/includes'
import memoize from '../utils/memoize' import memoize from '../utils/memoize'
import { Record } from 'immutable' import { Record } from 'immutable'
@@ -288,7 +287,6 @@ class Selection extends new Record(DEFAULTS) {
normalize(node) { normalize(node) {
let selection = this let selection = this
const { isCollapsed } = selection
let { anchorKey, anchorOffset, focusKey, focusOffset, isBackward } = selection let { anchorKey, anchorOffset, focusKey, focusOffset, isBackward } = selection
// If the selection isn't formed yet or is malformed, ensure that it is // If the selection isn't formed yet or is malformed, ensure that it is

View File

@@ -1,10 +1,8 @@
import Document from './document' import Document from './document'
import Mark from './mark'
import Selection from './selection' import Selection from './selection'
import Transform from './transform' import Transform from './transform'
import uid from '../utils/uid'
import { Record, Set, Stack, List } from 'immutable' import { Record, Set, Stack, List } from 'immutable'
/** /**

View File

@@ -192,7 +192,6 @@ class Text extends new Record(DEFAULTS) {
*/ */
getRanges(decorators = []) { getRanges(decorators = []) {
const node = this
const list = new List() const list = new List()
let characters = this.getDecorations(decorators) let characters = this.getDecorations(decorators)

View File

@@ -59,7 +59,7 @@ class Transform {
let { state, operations } = transform let { state, operations } = transform
let { history } = state let { history } = state
let { undos, redos } = history let { undos } = history
const previous = undos.peek() const previous = undos.peek()
// If there are no operations, abort early. // If there are no operations, abort early.

View File

@@ -7,7 +7,6 @@ import React from 'react'
import String from '../utils/string' import String from '../utils/string'
import getWindow from 'get-window' import getWindow from 'get-window'
import { IS_MAC } from '../constants/environment' import { IS_MAC } from '../constants/environment'
import { default as defaultSchema } from './schema'
/** /**
* Debug. * Debug.

View File

@@ -1,13 +1,7 @@
import Block from '../models/block'
import Document from '../models/document'
import Inline from '../models/inline'
import Mark from '../models/mark'
import Raw from './raw' import Raw from './raw'
import React from 'react' import React from 'react'
import ReactDOMServer from 'react-dom/server' import ReactDOMServer from 'react-dom/server'
import State from '../models/state'
import Text from '../models/text'
import cheerio from 'cheerio' import cheerio from 'cheerio'
import typeOf from 'type-of' import typeOf from 'type-of'
import { Record } from 'immutable' import { Record } from 'immutable'

View File

@@ -1,7 +1,5 @@
import Debug from 'debug' import Debug from 'debug'
import uid from '../utils/uid'
import { default as defaultSchema } from '../plugins/schema'
/** /**
* Debug. * Debug.

View File

@@ -633,7 +633,7 @@ export function wrapInline(transform, properties) {
export function wrapText(transform, prefix, suffix = prefix) { export function wrapText(transform, prefix, suffix = prefix) {
const { state } = transform const { state } = transform
const { document, selection } = state const { selection } = state
const { anchorOffset, anchorKey, focusOffset, focusKey, isBackward } = selection const { anchorOffset, anchorKey, focusOffset, focusKey, isBackward } = selection
let after let after

View File

@@ -1,6 +1,5 @@
import Normalize from '../utils/normalize' import Normalize from '../utils/normalize'
import uid from '../utils/uid'
/** /**
* Add mark to text at `offset` and `length` in node by `path`. * Add mark to text at `offset` and `length` in node by `path`.
@@ -137,7 +136,6 @@ export function joinNodeOperation(transform, path, withPath) {
export function moveNodeOperation(transform, path, newPath, newIndex) { export function moveNodeOperation(transform, path, newPath, newIndex) {
const { state } = transform const { state } = transform
const { document } = state
const parentPath = path.slice(0, -1) const parentPath = path.slice(0, -1)
const parentIndex = path[path.length - 1] const parentIndex = path[path.length - 1]
const inversePath = newPath.slice().concat([newIndex]) const inversePath = newPath.slice().concat([newIndex])

View File

@@ -10,7 +10,6 @@
function isInRange(index, text, range) { function isInRange(index, text, range) {
const { startKey, startOffset, endKey, endOffset } = range const { startKey, startOffset, endKey, endOffset } = range
let matcher
if (text.key == startKey && text.key == endKey) { if (text.key == startKey && text.key == endKey) {
return startOffset <= index && index < endOffset return startOffset <= index && index < endOffset