Extension talk:SVGEdit

Latest comment: 9 years ago by Andreas Jonsson in topic SVGEdit extension and svg-edit.2.7: Unable to save image

Not working in MediaWiki 1.31

edit

I've tried to make working this extension under MediaWiki 1.31 (the latest at the moment) but there some issue with it. Even I've downloaded the latest version (master) from github.com (/wikimedia/mediawiki-extensions-SVGEdit) there is an error thrown in javascript when clicking "Edit drawing" for valid SVG file: TypeError: mwSVG is undefined

There are shown some warning as well, but I expect that they are not rootcause of the issue: This page is using the deprecated ResourceLoader module "jquery.ui.widget". load.php:31:942 This page is using the deprecated ResourceLoader module "jquery.ui.core". Please use OOUI instead.

Initial

edit

This extension is awesome but is there a way to create a new svg from scratch without having to upload one? That's the killer missing feature.. --Alterego 02:29, 16 December 2010 (UTC)Reply

It should indeed be possible to add that. :D --brion
Apply this simple patch and it will be possible. Brion, could you include this patch into trunk? --VitaliyFilippov 17:53, 9 March 2011 (UTC)Reply
Looks like this duplicates the recent work adding a button to the edit toolbar to create a new file... or is the idea to show on non-existing File: pages so it then saves to that file? --brion 19:47, 9 March 2011 (UTC)Reply
Yeah, the idea is to show the button on non-existing File: pages. Patch fixes some js errors and uses #mw-imagepage-nofile as placeholder for SVGEdit, plus text on the button is changed so it tells about creating a new file. --VitaliyFilippov 17:15, 19 March 2011 (UTC)Reply
Actually that's quite clever. :D I'll peek it over when my MW time permits... --brion 18:50, 21 March 2011 (UTC)Reply
Index: modules/ext.svgedit.editButton.js
===================================================================
--- modules/ext.svgedit.editButton.js	(revision 83596)
+++ modules/ext.svgedit.editButton.js	(working copy)
@@ -22,7 +22,7 @@
 		var trigger = function() {
 			mw.svgedit.open({
 				filename: wgTitle,
-				replace: '#file',
+				replace: (wgArticleId ? '#file' : '#mw-imagepage-nofile'),
 				onclose: function(filename) {
 					if (filename) {
 						// Saved! Refresh parent window...
@@ -48,12 +48,13 @@
 		});
 
 		var button = $('<button></button>')
-			.text(mw.msg('svgedit-editbutton-edit'))
+			.text(mw.msg(wgArticleId ? 'svgedit-editbutton-edit' : 'svgedit-editbutton-create'))
 			.click(function() {
 				trigger();
 			});
-		$('.fullMedia').append(button);
 
+		$(wgArticleId ? '.fullMedia' : '#mw-imagepage-nofile').append(button);
+
 		if (window.location.hash.indexOf('!action=svgedit') != -1) {
 			window.location.hash = '';
 			trigger();
Index: modules/ext.svgedit.editor.js
===================================================================
--- modules/ext.svgedit.editor.js	(revision 83596)
+++ modules/ext.svgedit.editor.js	(working copy)
@@ -31,7 +31,7 @@
 		if ("filename" in options) {
 			// Get some basic info on the image before we go barrelling in...
 			mwSVG.fetchInfo(options.filename, function(imageinfo) {
-				mw.svgedit.openEditor(options, imageinfo);
+				mw.svgedit.openEditor(options, imageinfo || {});
 			});
 		} else {
 			mw.svgedit.openEditor(options, {});
@@ -60,7 +60,7 @@
 			url += '?dimensions=' + origWidth + ',' + origHeight;
 		}
 
-		var preferredHeight = origHeight + 180; // leave space for toolbars and UI inside the iframe
+		var preferredHeight = origHeight ? origHeight + 180 : 500; // leave space for toolbars and UI inside the iframe
 		var windowHeight = $(window).height() - 40; // leave space for our toolbar outside the iframe
 		var minHeight = Math.min(windowHeight, preferredHeight);
 		var initHeight = Math.max(minHeight, minHeight);
Index: SVGEdit.i18n.php
===================================================================
--- SVGEdit.i18n.php	(revision 83596)
+++ SVGEdit.i18n.php	(working copy)
@@ -13,6 +13,7 @@
  */
 $messages['en'] = array(
 	'svgedit-editbutton-edit' => 'Edit drawing',
+	'svgedit-editbutton-create' => 'Create image with SVGEdit',
 	'svgedit-summary-label' => 'Edit summary',
 	'svgedit-summary-default' => '/* Modified in svg-edit */',
 	'svgedit-editor-save-close' => 'Save and close',
@@ -387,6 +388,7 @@
  */
 $messages['ru'] = array(
 	'svgedit-editbutton-edit' => 'Редактировать рисунок',
+	'svgedit-editbutton-create' => 'Создать рисунок в SVGEdit',
 	'svgedit-summary-label' => 'Описание изменений',
 	'svgedit-summary-default' => '/* Изменено в svg-edit */',
 	'svgedit-editor-save-close' => 'Сохранить и закрыть',
Index: SVGEdit.php
===================================================================
--- SVGEdit.php	(revision 83596)
+++ SVGEdit.php	(working copy)
@@ -59,6 +59,7 @@
 		),
 		'messages' => array(
 			'svgedit-editbutton-edit',
+			'svgedit-editbutton-create',
 			'svgedit-edit-tab',
 			'svgedit-edit-tab-tooltip'
 		),

No note in Special:Version?

edit

Would it be possible to have the next version of the editor include a line in Special:Version? I had been trying forever to verify whether the extension installed properly or not, because I did not see anything in the Version list.

Thanks!

--Peter

If you have installed the extension, there will indeed be a line in Special:Version. (If you have set up a local gadget, then there won't be.) --brion 18:49, 29 August 2011 (UTC)Reply

Integration with WikiEditor

edit

I am having real trouble in getting this extension to work. I cannot see the new button in WikiEditor that the documentation says should appear. To be clear, I have completed the following steps:

  1. Extracted the extension to the extensions/SVGEdit directory so that in that directory svgedit.php exists.
  2. Added require_once("$IP/extensions/SVGEdit/SVGEdit.php"); to my LocalSettings.php
  3. Added the line $wgFileExtensions[] = 'svg'; to LocalSettings.php to "enable SVG support" I hope that was the right thing to do.

Is there anything else I need to complete to make the extension work? I feel I must be missing something obvious.

What version of MW are you running? --brion 18:35, 28 November 2011 (UTC)Reply
1.17 - I am using a Bitnami stack, at the time it was 1.17 but I see that they have updated to 1.18 on their website.

YEY!!! I fixed my own problem!!!

  • Upgraded to 1.18
  • Upgraded WikiEditor to the 1.18 version

Bish bash bosh - an icon appeared on the toolbar to begin creating SVG diagrams!

Missing instructions for installing svg-editor

edit

When I follow the instructions exactly, using MW 1.18.1, I get the following message when using the WikiEditor button for creating an new SVG:

The requested URL /wiki/extensions/SVGEdit/svg-edit/svg-editor.html was not found on this server.

Although it may be foggily implied, there's nothing in the installation instructions that says we need to install an svg-editor, nor where.

65.110.153.40 21:46, 14 May 2012 (UTC)Reply

<aol>Me2</aol> Am I missing something? --2001:980:331A:1:225:22FF:FE7D:8A27 15:01, 14 June 2012 (UTC)Reply

Found it, svgedit itself is definitely a different/bigger kettle of fish, and needs to be downloaded separately. --2001:980:331A:1:225:22FF:FE7D:8A27 16:13, 14 June 2012 (UTC)Reply

No links?

edit

Currently SVGEdit does not allow users to add IRI's (URI's) to objects. Isn't it supposed to be a wiki? ;-) --2001:980:331A:1:225:22FF:FE7D:8A27 16:13, 14 June 2012 (UTC)Reply

I know this is stupid and kind of bikeshed-y, but

edit

the name "SVGEdit" is super-roboty. I wonder if the extension wouldn't attract more attention/love if it were named something else. I'd really like to see this extension live on Wikimedia wikis, but it may need a bit of sex appeal to get resources. Just a thought. --MZMcBride (talk) 01:01, 17 November 2012 (UTC)Reply

VectorFlow? ;) --brion (talk) 01:38, 17 November 2012 (UTC)Reply

Error saving file

edit

I have the SVG-editor button in the advanced toolbar, the latest stable editor is installed, and SVG-edit opens and I can start drawing. However, I cannot save the new drawing, but get this error message in a small dialog box when I hit the Save and close button:

"Error saving file"

Suggestions?


-After i search, i just change the access for image file into 770 or 777 for the image folder. Then it will create folder "lockdir". Then it will show empty images, after that we can embedded files that can be view at list of uploaded files.
-At my case, it will be take error at create thumbnails. And i still search for solution. Thank you--Sephirothindra (talk) 06:27, 20 June 2013 (UTC)Reply

-Ups for Error Create thumbnails, it resolved with update of PHP version 5.4.5 (apache2handler). But for svg-editor it still there is a bug when we create arrow, it will goes not in place.--By Sephirothindra 07:02, 27 June 2013 (UTC)

Cannot get it to work with MediaWiki 1.22

edit

I installed svg-edit (latest - 2.6) and installed SVGEdit (latest - "snapshot of version 56294d9"), updated my LocalSettings (of course), and added '.svg' to the list of allowed file types. I also disabled the use of external renderers for creating thumbnails - forcing MediaWiki to use the SVG as-is and not create any PNG, etc.

I created a trivial SVG test image using svg-edit (the very version that I downloaded) and saved the file.

I uploaded the test image file to my MediaWiki instance (1.22). The Files: page lists the file and shows the preview properly - all good so far. When I click on the entry for the uploaded SVG file, there is an "Edit Drawing" button as expected. When I click on it, svg-edit starts to open: it displays the svg-edit user interface, BUT it is grayed out, and contains a swirling progress circle that swirls forever. The permissions on my MediaWiki images directory are 777.

Any thoughts?

-- Possible reply

Hello, Do you have modified your SVGEdit extension (file SVGEdit.php) to tell that you are using your local svg-edit, and not the remote one delivered by google ?

Example:

 $wgSVGEditEditor = "<YOUR_LOCAL_SVG-EDIT>/svg-editor.html";

SVGEdit extension and svg-edit.2.7: Unable to save image

edit

April 2014: svg-edit 2.7 has been released (https://code.google.com/p/svg-edit/wiki/VersionHistory) This new version brings several enhancements and solves many issues including one encountered when drawing objects with Firefox (wrong calc on mouse x/y within svgcanvass). Unfortunately, after installing and configuring the new version of svg-edit the "save and close" button doesn't work: - after clicking the "save and close" button (#mw-svgedit-save) the spinnerOn() function enables the spinner, the svgedit.getSvgString() functions seems to be properly overwritten with the callback function "function(svg)" but the svg variable (which should contain the svg data) has no value. (I tried to debug/giggle a bit in the code but I was unable to find out exactly the root cause.. not sure if the problem is with jquery, or the svg variable or the native svg-edit function changes..)

- I think this is related, but I cannot use the plugin at all using svg-edit 2.7, 2.6 and MW 1.23. I just get the spinning box and it never "loads". The svg-edit utility is fully loaded in the background, including a previous edit (from loading it manually outside of this extension). It looks like the extension never successfully opens the svg to modify in the svg-edit frame. - Lee

- It seems that for svg-edit-2.7 the callback returned by getSvgString never fires and it therefore never uploads anything. Furthermore the default configuration changed such that a dialog is presented to choose a browser-local storage. If answered with yes, svg-edit loads the image data from the storage, even though the file I tried to edit did not exist at all. This suggests that the loading also does not work. --Dev-zero (talk) 12:51, 5 August 2014 (UTC)Reply

- The message passing API has changed in 2.7. Just copy the file embedapi.js from svg-edit 2.7 to modules/ext.svgedit.embedapi.js in the SVGEdit directory and it will work. I've tested this on MW 1.23. --Andreas Jonsson (talk) 16:53, 23 May 2015 (UTC)Reply

Hard to set up cross-origin and damages SVGs

edit

Tried it here.

  1. First, I had to update the embed API.
  2. Then, the svg-edit static host had to be configured a) not to be abused b) to allow the origin it is used on.
  3. Finally I had again to patch the extension to make it communicating with the static host.
ParamStatic hostHost embedding it as iframe (running MediaWiki)
URL embedapi.html, svg-editor.html sample image modified by SVGEdit
Modifications to make it running Configuration file See GitHub commit history

All acceptable if it would work as expected but unfortunately svg-edit seems to have some bugs damaging SVGs. Otherwise awesome software that just needs a bit of UI-polishing. -- Rillke (talk) 13:45, 4 July 2014 (UTC)Reply

Grayed-out, just spins

edit

I've tried every combination I can think of, latest mediawiki (25.1), latest svg-edit, latest version of the extension, previous versions of everything (except mediawiki), both local and remote, but, though SVGEdit runs and renders, the screen remains grayed-out, with the spinning icon in the middle.

Any suggestions? Does this work out-of-the box with current everything?

Not listed in Phabricator

edit

I'm running REL1_34 and have the latest code for SVGEdit locally (from GitHub, code.google.com is defunct). It doesn't work* and I'd like to report it, but the project is not listed (even as an archived project) in Phabricator. I can see Brion made a commit as late as April, so I'm not ready to write off this extension as un-maintained, but what's the status? Can it be added to Phabricator so that tasks can be logged?

  • Uncaught TypeError: Cannot read property 'fetchInfo' of undefined
    (function($, mw) {
        var mwSVG;
        mw.svgedit = {
            isOpen: !1,
            init: function() {},
            open: function(options) {
                if (mw.svgedit.isOpen) {
                    return false;
                }
                mw.svgedit.isOpen = !0;
                if ('filename'in options) {
                    mwSVG.fetchInfo(options.filename, function(imageinfo) {
                        mw.svgedit.openEditor(options, imageinfo);
                    });
                } else {
                    mw.svgedit.openEditor(options, {});
                }
            },

Edit Button Does Not Work

edit

Mediawiki 1.38.4


Extension is installed


Edit Button in editor does not launch program. Same problem as other poster.

Uncaught TypeError: Cannot read property 'fetchInfo' of undefined

_______________

I updated to the latest 1.40 mediawiki.

I get the same error.

Is this extension missing instructions or something?

Return to "SVGEdit" page.