Created
February 14, 2011 04:51
-
-
Save hungrysquirrel/825498 to your computer and use it in GitHub Desktop.
Corrects the odd formatting of height and width when pasted into text editor
This file contains hidden or 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
/* | |
------------------------------------ | |
Copy CSS Dimensions v1.0 | |
------------------------------------ | |
Created by Matt Stow 2010 | |
http://www.mattstow.com | |
------------------------------------ | |
*/ | |
(function() | |
{ | |
if (fw.documents.length == 0) { | |
return; | |
} | |
if (fw.selection != null && fw.selection.length == 1) { | |
var originalSelection = [].concat(fw.selection); | |
var dom = fw.getDocumentDOM(); | |
var css = "height: " + fw.selection[0].height + "px;" + "\r\n" + "width: " + fw.selection[0].width + "px;" | |
dom.addNewText({left:-100, top:-100, right:-100, bottom:-100}, true); | |
var tr = fw.selection[0].textRuns; | |
tr.textRuns = [{changedAttrs: {}, characters:css}]; | |
fw.selection[0].textRuns = tr; | |
dom.clipCopyFormats("(ADOBE AI3)"); | |
dom.deleteSelection(false); | |
fw.selection = originalSelection; | |
} | |
else { | |
alert("Please select an object before running this command"); | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment