-
-
Save Yopi/efa24cdfb54cc2b2b415a709fb4f79d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContentTools.Tools.YogobeVideo extends ContentTools.Tool | |
# Insert a video. | |
ContentTools.ToolShelf.stow(@, 'yogobe-readmore') | |
@label = 'Yogobe Read More' | |
@icon = 'read-more' | |
@canApply: (element, selection) -> | |
# Return true if the tool can be applied to the current | |
# element/selection. | |
return not element.isFixed() | |
@apply: (element, selection, callback) -> | |
# Apply the tool to the current element | |
read_more = new ContentEdit.YogobeReadMore( | |
'yogobe-readmore', {}) | |
# Find insert position | |
[node, index] = @_insertAt(element) | |
node.parent().attach(read_more, index) | |
# Focus the new video | |
read_more.focus() | |
callback(true) | |
ContentTools.DEFAULT_TOOLS[2].push('yogobe-readmore') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment