Extension talk:SVGEdit

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)

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 = $(' ') -			.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' ),