Skip to content

Commit

Permalink
disable tooltips #289
Browse files Browse the repository at this point in the history
  • Loading branch information
forresto committed Sep 29, 2016
1 parent c854ca5 commit 29c1e60
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 60 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
@@ -1,5 +1,9 @@
### dev

## 1.2.0 - 2016-09-29

* Disable tooltip (to potentially revisit later) (#289)

### 1.1.3 - 2016-09-27

* Add needed margin-top when tooltip menu is enabled
Expand Down
22 changes: 2 additions & 20 deletions demo/demo.js
Expand Up @@ -7,9 +7,6 @@ import gremlinProsemirror from './gremlin-prosemirror'

let ed
const fixtureContent = fixture.content
const isTouchDevice = ('ontouchstart' in window)
let menu = isTouchDevice ? 'bar' : 'tip'
// menu = 'bar'

let apiJSON = document.querySelector('#debug-api')

Expand All @@ -26,8 +23,6 @@ function setup (options) {
}
const props =
{ initialContent: (options.initialContent || [])
, menuTip: (options.menu === 'tip')
, menuBar: (options.menu === 'bar')
, onChange: () => { console.log('change') }
, onMount: () => { console.log('mount') }
, onShareFile: onShareFileDemo
Expand All @@ -54,7 +49,7 @@ function setup (options) {
initializePlaceholderMetadata(props.initialContent)
}
const initialContent = (window.location.hash === '#fixture' ? fixtureContent : [])
setup({menu, initialContent})
setup({initialContent})

// onShareFile upload demo
let input
Expand Down Expand Up @@ -207,19 +202,6 @@ toggleDebug.onclick = () => {
showDebug = !showDebug
}

// Switch menu
let toggleMenu = document.querySelector('#menu')
toggleMenu.onclick = function (event) {
if (menu === 'tip') {
menu = 'bar'
toggleMenu.textContent = 'Switch to menu tooltip'
} else {
menu = 'tip'
toggleMenu.textContent = 'Switch to menu bar'
}
setup({menu})
}

// Hydrate
function APIToEditor () {
let json
Expand Down Expand Up @@ -265,7 +247,7 @@ bangOnContent.click()
// Load full post
function loadFixture () {
window.location.hash = '#fixture'
setup({menu, initialContent: fixtureContent})
setup({initialContent: fixtureContent})
}
document.querySelector('#fixture').onclick = loadFixture

Expand Down
1 change: 0 additions & 1 deletion index.html
Expand Up @@ -17,7 +17,6 @@

<div id="debug">
<div id="debug-buttons">
<button id="menu" class="w100 mb1">Switch menu</button>
<button id="sim" class="w100 mb1">Simulate changes from API ▶</button>
<button id="dehydrate" class="w100 mb1">← Editor to Grid API</button>
<button id="hydrate" class="w100 mb1">→ Grid API to Editor</button>
Expand Down
6 changes: 0 additions & 6 deletions src/components/app.js
Expand Up @@ -84,8 +84,6 @@ export default class App extends React.Component {
}
renderContent () {
const { initialContent
, menuBar
, menuTip
, onShareFile
, onShareUrl
, onCommandsChanged
Expand All @@ -101,8 +99,6 @@ export default class App extends React.Component {
}
, el(Editable
, { initialContent
, menuBar
, menuTip
, onChange: this.routeChange
, onShareFile
, onShareUrl
Expand Down Expand Up @@ -179,8 +175,6 @@ App.propTypes =
, onDropFiles: React.PropTypes.func
, onCommandsChanged: React.PropTypes.func
, onRequestCoverUpload: React.PropTypes.func.isRequired
, menuBar: React.PropTypes.bool
, menuTip: React.PropTypes.bool
, imgfloConfig: React.PropTypes.object
, widgetPath: React.PropTypes.string
, coverPrefs: React.PropTypes.object
Expand Down
37 changes: 11 additions & 26 deletions src/components/editable.js
Expand Up @@ -5,8 +5,8 @@ import React, {createElement as el} from 'react'
import {ProseMirror} from 'prosemirror/dist/edit/main'
import {Plugin} from 'prosemirror/dist/edit/plugin'

import {menuBar as pluginMenuBar, tooltipMenu as pluginMenuTip} from 'prosemirror/dist/menu'
import {edBlockMenu, edInlineMenu, edBarMenu} from '../menu/ed-menu'
import {menuBar as pluginMenuBar} from 'prosemirror/dist/menu'
import {edBarMenu} from '../menu/ed-menu'

import GridToDoc from '../convert/grid-to-doc'
import EdKeymap from '../inputrules/ed-keymap'
Expand Down Expand Up @@ -47,8 +47,6 @@ class Editable extends React.Component {
componentDidMount () {
const {mirror, plugins} = this.refs
const { initialContent
, menuBar
, menuTip
, onChange
, onCommandsChanged
, widgetPath
Expand All @@ -71,26 +69,15 @@ class Editable extends React.Component {
, PluginContentHints
, PluginPlaceholder
]
if (menuBar) {
let menu = pluginMenuBar.config(
{ float: false
, content: edBarMenu
}
)
pmOptions.plugins.push(menu)
edPluginClasses.push(PluginFixedMenuHack)
}
if (menuTip) {
let menu = pluginMenuTip.config(
{ showLinks: true
, selectedBlockMenu: true
, inlineContent: edInlineMenu
, blockContent: edBlockMenu
, selectedBlockContent: edBlockMenu
}
)
pmOptions.plugins.push(menu)
}

let menu = pluginMenuBar.config(
{ float: false
, content: edBarMenu
}
)
pmOptions.plugins.push(menu)
edPluginClasses.push(PluginFixedMenuHack)

if (onCommandsChanged) {
edPluginClasses.push(PluginCommandsInterface)
}
Expand Down Expand Up @@ -153,8 +140,6 @@ Editable.propTypes =
, onDropFiles: React.PropTypes.func
, onEditableInit: React.PropTypes.func
, onCommandsChanged: React.PropTypes.func
, menuBar: React.PropTypes.bool
, menuTip: React.PropTypes.bool
, widgetPath: React.PropTypes.string
, coverPrefs: React.PropTypes.object
}
Expand Down
7 changes: 0 additions & 7 deletions src/menu/ed-menu.js
Expand Up @@ -90,12 +90,5 @@ export const edBlockMenu =
, [ menuMedia ]
]

export const edInlineMenu =
[ [ toggleStrong
, toggleEm
, toggleLink
]
]

export const edBarMenu = edBlockMenu
.concat([[undoItem, redoItem]])

0 comments on commit 29c1e60

Please sign in to comment.