Extension talk:SVGEdit

From MediaWiki.org
Jump to: navigation, search

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)

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)
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)
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)
Actually that's quite clever. :D I'll peek it over when my MW time permits... --brion 18:50, 21 March 2011 (UTC)
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'
                ),

Contents

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)

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)
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)

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

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)

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)

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)

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

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?