From 57125bc237935b5b8cec30d6ad0a438161e138a4 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Tue, 16 Feb 2010 21:07:13 +0000 Subject: [PATCH] Made extension improvements to svg-editor.js and added foreignObject plugin based on patch by Jaques Distler (disabled by default) git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1395 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/extensions/ext-foreignobject.js | 271 ++++++++++++++++++++++ editor/extensions/foreignobject-icons.xml | 96 ++++++++ editor/svg-editor.css | 12 +- editor/svg-editor.html | 1 + editor/svg-editor.js | 156 +++++++------ 5 files changed, 456 insertions(+), 80 deletions(-) create mode 100644 editor/extensions/ext-foreignobject.js create mode 100644 editor/extensions/foreignobject-icons.xml diff --git a/editor/extensions/ext-foreignobject.js b/editor/extensions/ext-foreignobject.js new file mode 100644 index 00000000..4bb9ba23 --- /dev/null +++ b/editor/extensions/ext-foreignobject.js @@ -0,0 +1,271 @@ +/* + * ext-foreignobject.js + * + * Licensed under the Apache License, Version 2 + * + * Copyright(c) 2010 Jacques Distler + * Copyright(c) 2010 Alexis Deveria + * + */ + +$(function() { + svgCanvas.addExtension("foreignObject", function(S) { + var svgcontent = S.svgcontent, + addElem = S.addSvgElementFromJson, + selElems, + svgns = "http://www.w3.org/2000/svg", + xlinkns = "http://www.w3.org/1999/xlink", + xmlns = "http://www.w3.org/XML/1998/namespace", + xmlnsns = "http://www.w3.org/2000/xmlns/", + se_ns = "http://svg-edit.googlecode.com", + htmlns = "http://www.w3.org/1999/xhtml", + mathns = "http://www.w3.org/1998/Math/MathML", + editingforeign = false, + svgdoc = S.svgroot.parentNode.ownerDocument; + + + var properlySourceSizeTextArea = function(){ + // TODO: remove magic numbers here and get values from CSS + var height = $('#svg_source_container').height() - 80; + $('#svg_source_textarea').css('height', height); + }; + + function showPanel(on) { + var fc_rules = $('#fc_rules'); + if(!fc_rules.length) { + fc_rules = $('