-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,300 additions
and
62 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ Phase 1: | |
* Text-spacing | ||
* Rotation | ||
* ✓ Opacity | ||
* content editable | ||
|
||
Phase 2: | ||
|
||
|
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
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
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
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
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
32 changes: 32 additions & 0 deletions
32
assets/javascripts/app/controllers/stage/clipboard.module.coffee
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class Clipboard | ||
constructor: (@stage) -> | ||
$(window).bind 'beforecopy', @cancel | ||
$(window).bind 'copy', @copy | ||
|
||
$(window).bind 'beforepaste', @cancel | ||
$(window).bind 'paste', @paste | ||
|
||
cancel: (e) => | ||
# We need to cancel the default to get | ||
# the 'copy' event to trigger | ||
e.preventDefault() | ||
|
||
copy: (e) => | ||
return unless @stage.selection.isAny() | ||
|
||
e.preventDefault() | ||
e = e.originalEvent | ||
|
||
json = JSON.stringify(@stage.selection.elements) | ||
e.clipboardData.setData('json/x-stylo', json) | ||
|
||
html = (el.outerHTML() for el in @stage.selection.elements) | ||
e.clipboardData.setData('text/html', html.join("\n")) | ||
|
||
styles = (el.outerCSS() for el in @stage.selection.elements) | ||
e.clipboardData.setData('text/plain', styles.join("\n\n")) | ||
|
||
paste: (e) => | ||
console.log('paste', e) | ||
|
||
module.exports = Clipboard |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
Collection = require('lib/collection') | ||
Serialize = require('./serialize').Serialize | ||
|
||
class Values extends Collection | ||
toString: -> | ||
@join(', ') | ||
|
||
class Property | ||
class Property extends Spine.Module | ||
@include Serialize | ||
|
||
module.exports = Property | ||
module.exports.Values = Values |
Oops, something went wrong.