Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added image width and height functionality

  • Loading branch information...
commit c9798abf4effd34606f59c1725c886ba141f40b0 1 parent e25b318
@davestewart authored
Showing with 24 additions and 5 deletions.
  1. +24 −5 content/main/components/places.js
View
29 content/main/components/places.js
@@ -182,7 +182,7 @@ autocode.places =
// variables
// debug
- clear();
+ //clear();
// exit if the file is not saved yet
var viewDoc = (view.koDoc || view.document);
@@ -468,10 +468,29 @@ autocode.places =
ko.statusBar.AddMessage(message, 'autocode.places', 3000);
// insert the text
- scimoz.beginUndoAction();
- scimoz.gotoPos(scimoz.currentPos);
- ko.abbrev.insertAbbrevSnippet(snippet, view);
- scimoz.endUndoAction();
+ function insert()
+ {
+ scimoz.beginUndoAction();
+ scimoz.gotoPos(scimoz.currentPos);
+ ko.abbrev.insertAbbrevSnippet(snippet, view);
+ scimoz.endUndoAction();
+ }
+
+ // depending on whether an image or normal file, insert now, or when loaded
+ if(/(png|jpg|jpeg|gif)/.test(fileExt))
+ {
+ var image = new Image();
+ image.src = itemURI;
+ image.onload = function()
+ {
+ snippet.populate( {width:image.width, height:image.height} );
+ insert();
+ }
+ }
+ else
+ {
+ insert();
+ }
// ----------------------------------------------------------------------------------------------------
// done
Please sign in to comment.
Something went wrong with that request. Please try again.