diff --git a/editor/extensions/ext-imagelib.js b/editor/extensions/ext-imagelib.js
index 0b5ccb85..49df1729 100644
--- a/editor/extensions/ext-imagelib.js
+++ b/editor/extensions/ext-imagelib.js
@@ -90,7 +90,7 @@ svgEditor.addExtension("imagelib", function() {
function showBrowser() {
var browser = $('#imgbrowse');
if(!browser.length) {
- $('
\
+ $('
').insertAfter('#svg_docprops');
browser = $('#imgbrowse');
@@ -101,24 +101,27 @@ svgEditor.addExtension("imagelib", function() {
var header = $('
').prependTo(browser).text(all_libs);
- var cancel = $('').appendTo(browser).click(function() {
+ var cancel = $('').appendTo(browser).click(function() {
$('#imgbrowse_holder').hide();
}).css({
position: 'absolute',
top: 5,
- right: 5
+ right: -10
});
- var back = $('').appendTo(browser).click(function() {
+ var back = $('').appendTo(browser).click(function() {
frame.attr('src', 'about:blank').hide();
lib_opts.show();
header.text(all_libs);
}).css({
position: 'absolute',
top: 5,
- left: 5
+ left: 10
});
+ cancel.prepend($.getSvgIcon('cancel', true));
+ back.prepend($.getSvgIcon('tool_imagelib', true));
+
$.each(img_libs, function(i, opts) {
$('
').appendTo(lib_opts).text(opts.name).click(function() {
frame.attr('src', opts.url).show();
@@ -175,7 +178,7 @@ svgEditor.addExtension("imagelib", function() {
#imgbrowse > div,\
#imgbrowse > ul {\
position: absolute;\
- top: 36px;\
+ top: 45px;\
left: 10px;\
right: 10px;\
bottom: 10px;\
diff --git a/editor/extensions/ext-imagelib.xml b/editor/extensions/ext-imagelib.xml
index 2834b8d6..936578c0 100644
--- a/editor/extensions/ext-imagelib.xml
+++ b/editor/extensions/ext-imagelib.xml
@@ -1,10 +1,14 @@
\ No newline at end of file
diff --git a/editor/extensions/ext-server_opensave.js b/editor/extensions/ext-server_opensave.js
index d197c372..278d9e5b 100644
--- a/editor/extensions/ext-server_opensave.js
+++ b/editor/extensions/ext-server_opensave.js
@@ -18,7 +18,7 @@ svgEditor.addExtension("server_opensave", {
svgEditor.setCustomHandlers({
save: function(win, data) {
- var svg = "\n" + data;
+ var svg = "\n" + data;
var title = svgCanvas.getDocumentTitle();
var filename = title.replace(/[^a-z0-9\.\_\-]+/gi, '_');
diff --git a/editor/svg-editor.js b/editor/svg-editor.js
index 3417b436..75d6ae1f 100644
--- a/editor/svg-editor.js
+++ b/editor/svg-editor.js
@@ -724,7 +724,7 @@
opts.fn();
}
if(opts.icon) {
- var icon = $.getSvgIcon(opts.icon).clone();
+ var icon = $.getSvgIcon(opts.icon, true);
} else {
//
var icon = $(opts.sel).children().eq(0).clone();
@@ -2601,7 +2601,7 @@
}
var setIcon = Editor.setIcon = function(elem, icon_id, forcedSize) {
- var icon = (typeof icon_id == 'string') ? $.getSvgIcon(icon_id) : icon_id;
+ var icon = (typeof icon_id == 'string') ? $.getSvgIcon(icon_id, true) : icon_id;
if(!icon) {
console.log('NOTE: Icon image missing: ' + icon_id);
return;
diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js
index bf9814b1..59370d69 100644
--- a/editor/svgcanvas.js
+++ b/editor/svgcanvas.js
@@ -2154,8 +2154,6 @@ var getStrokedBBox = this.getStrokedBBox = function(elems) {
// bb.width = rmaxx - rminx;
// bb.height = rmaxy - rminy;
}
-
- return bb;
} catch(e) {
console.log(elem, e);
return null;
@@ -2167,9 +2165,11 @@ var getStrokedBBox = this.getStrokedBBox = function(elems) {
if(full_bb) return;
if(!this.parentNode) return;
full_bb = getCheckedBBox(this);
- var b = {};
- for(var i in full_bb) b[i] = full_bb[i];
- full_bb = b;
+ if(full_bb) {
+ var b = {};
+ for(var i in full_bb) b[i] = full_bb[i];
+ full_bb = b;
+ }
});
@@ -7496,7 +7496,7 @@ var removeUnusedDefElems = this.removeUnusedDefElems = function() {
}
};
- var defelems = $(svgcontent).find("linearGradient, radialGradient, filter, marker");
+ var defelems = $(svgcontent).find("linearGradient, radialGradient, filter, marker, svg");
defelem_ids = [],
i = defelems.length;
while (i--) {
diff --git a/editor/svgicons/jquery.svgicons.js b/editor/svgicons/jquery.svgicons.js
index f77c60f9..5453f3bd 100644
--- a/editor/svgicons/jquery.svgicons.js
+++ b/editor/svgicons/jquery.svgicons.js
@@ -161,7 +161,7 @@ $(function() {
return new_el;
}
- var svg_icons = {};
+ var svg_icons = {}, fixIDs;
$.svgIcons = function(file, opts) {
var svgns = "http://www.w3.org/2000/svg",
@@ -424,7 +424,7 @@ $(function() {
}
- function fixIDs(svg_el, svg_num, force) {
+ fixIDs = function(svg_el, svg_num, force) {
var defs = svg_el.find('defs');
if(!defs.length) return svg_el;
@@ -498,7 +498,13 @@ $(function() {
}
}
- $.getSvgIcon = function(id) { return svg_icons[id]; }
+ $.getSvgIcon = function(id, uniqueClone) {
+ var icon = svg_icons[id];
+ if(uniqueClone) {
+ icon = fixIDs(icon, 0, true).clone(true);
+ }
+ return icon;
+ }
$.resizeSvgIcons = function(obj) {
// FF2 and older don't detect .svg_icon, so we change it detect svg elems instead