likaiguo / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

url prefix #426

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
On various places 
editor/locale/locale.js, editor/svg-editor.js, editor/svgcanvas.js
I need to inject my server url e.g.

locale:
var url = "/moin_static191/svg-edit/editor/locale/lang." + lang_param + ".js";

svg-editor:
var htdocs = '/moin_static191/svg-edit/';
var default_img_url = htdocs + "images/logo.png";

$.svgIcons('/moin_static191/svg-edit/editor/images/svg_edit_icons.svg'

fallback_path:'/moin_static190/svg-edit/editor/images/',

svgcanvas:
style": "cursor:url(/moin_static191/svg-edit/editor/images/rotate.png) 12
12, auto;"

there are some more. I would prefer a global var or however an easier way
as patching that into it.

Original issue reported on code.google.com by rb.p...@gmail.com on 19 Jan 2010 at 8:09

GoogleCodeExporter commented 9 years ago
Basically we should allow some configurable options to be sent into the 
SvgCanvas() call.

Original comment by codedr...@gmail.com on 19 Jan 2010 at 8:16

GoogleCodeExporter commented 9 years ago

Original comment by codedr...@gmail.com on 19 Jan 2010 at 8:16

GoogleCodeExporter commented 9 years ago
sounds interesting

http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Editor_Core_URLs_Manipula
tion
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.getUrl

Original comment by rb.p...@gmail.com on 19 Jan 2010 at 8:34

GoogleCodeExporter commented 9 years ago
i like the way ckeditor is dong it. 
what i don't know so far is where to place such a getUrl function within 
svg-edit.
since this function needs to be available for svgcanvas.js and svg-editor.js. 
and one
should be able to override it.
if i get some hints i'll glad to spend some time fixing this issue.

Original comment by not.impo...@gmail.com on 13 Feb 2010 at 1:26

GoogleCodeExporter commented 9 years ago
Since almost all images are used in svg-editor.js, I'd suggest the URL should be
configurable there.  svg-editor can then pass that URL down to SvgCanvas for the
remaining (rotate cursor).

Original comment by codedr...@gmail.com on 13 Feb 2010 at 1:30

GoogleCodeExporter commented 9 years ago
do you mean by URL a prefix? i think a prefix is not sufficent. see the exmple 
locale:
var url = "/moin_static191/svg-edit/editor/locale/lang." + lang_param + ".js"; 
in the
initial issue report.

did you have a look at
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.getUrl? 

how can i implement a method like getUrl, use where ever a path is used in 
svg-edit
and allowing this getUrl to be customized.

sorry for beeing a ignorant about javascript. but i really would like to learn 
and help.

Original comment by not.impo...@gmail.com on 13 Feb 2010 at 4:15

GoogleCodeExporter commented 9 years ago
rather not or I have a different understanding what a prefix is used for. May be
define prefix for me.

Original comment by rb.p...@gmail.com on 14 Feb 2010 at 8:56

GoogleCodeExporter commented 9 years ago
i understand a prefix as something that's prepend of something. the opposite of 
a suffix.

Original comment by not.impo...@gmail.com on 15 Feb 2010 at 2:51

GoogleCodeExporter commented 9 years ago
here a very naive implemtation of the feature described here
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.getUrl? 

Original comment by not.impo...@gmail.com on 15 Feb 2010 at 2:53

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, I think I've lost the thread of conversation here.  Basically if
svg_edit_setup() and SvgCanvas() allowed arguments like:

function svg_edit_setup(opts) {
...
}

And if opts was a JS object it could have the following:

basePath := determines the base path for fetching everything
defaultLang := ...
defaultBackground := ...

Then svgCanvas would also need a member function to fetch an option:

getOption(optName)

so that calling

svgCanvas.getOption("basePath") would return the configured value.

Then svgcanvas.js, locale.js would need to be updated so that it used the 
basePath.

Original comment by codedr...@gmail.com on 15 Feb 2010 at 3:12

GoogleCodeExporter commented 9 years ago
have you read 
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.getUrl?
(using a function to modify the path rather than using a prefix)
and what do you think about this approach?

Original comment by not.impo...@gmail.com on 16 Feb 2010 at 2:41

GoogleCodeExporter commented 9 years ago
sorry, I still don't fully follow what you're driving at, though I looked at the
getUrl() function docs.  Are you talking about a global variable that you set 
beforehand?

Original comment by codedr...@gmail.com on 16 Feb 2010 at 4:06

GoogleCodeExporter commented 9 years ago
no i don't talk about a global variable. i just liked the idea behind ckeditors 
geturl.

see this, i think its the better page:
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Editor_Core_URLs_Manipula
tion

especially: 
There are several cases that may benefit from this feature. Here we have a list 
of
few of them:

    * Point editor core files to be loaded from different directories with different
names. For example having the English language file coming from
"/mylangfiles/lang_en.js".
    * Having all editor files being served by a server process (like loading from the
database), instead of having them physically installed.
    * Some server applications may avoid directories structures. For example, we
could have the English language files renamed to "lang_en.js" and a skin file to
"skin_kama_editor.css" (all slashes replaced by underscores). 

this is why i bothering asking you. becuase it seems to me you only consider the
prefix approach.

as far as i concerned with integration svg-edit into yanel both ways ar ok for 
me.
but i see some benefits in doing it the ckeditor way. before i start to 
implement
something i would like this to be concerned.

Original comment by not.impo...@gmail.com on 16 Feb 2010 at 4:32

GoogleCodeExporter commented 9 years ago
Ok, I get it now :)

Basically CKEditor lets you write your own "URL provider" function that can map 
files
to URL on that particular installation.

I can see some benefits to this approach, though nothing is convincing me that 
this
functionality is essential.

This approach would require some re-factoring of the JS, so if you come up with
patches for this, please attach them to the bug.

On the other hand, if someone comes up with patches for providing that
configurability in a JSON object upon initializing, that's be fine too.

Original comment by codedr...@gmail.com on 16 Feb 2010 at 6:09

GoogleCodeExporter commented 9 years ago
i tried to solve the problem as described in comment 10.
the problem i hit so far is the path in $.svgIcons within the svg-editor.js 
file.
this is outside of the scope of everything.
any idea?

Original comment by not.impo...@gmail.com on 23 Feb 2010 at 9:28

GoogleCodeExporter commented 9 years ago
since no one commented i try to ask again.
how should the svgIcons initialisation (line2812 rev1437) have access to this
getOption(optName).

BTW i don't consider this a 'Good-First-Bug' anymore since it seems to me this 
is 
affecting a deeper problem e.g. initialisation of svg-edit

Original comment by not.impo...@gmail.com on 2 Mar 2010 at 10:10

GoogleCodeExporter commented 9 years ago
Hello - I have removed the tag.  Possibly Alexis (adeveria) can answer your 
question
with respect to the svgicons script, but is there any reason the svgicons script
can't also similarly be initialized?

Original comment by codedr...@gmail.com on 2 Mar 2010 at 10:15

GoogleCodeExporter commented 9 years ago
I have made some structural changes recently that should help support this, but 
will 
have to tweak it a little more to allow more options. 

Original comment by adeve...@gmail.com on 12 Mar 2010 at 9:28

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I believe this has been fixed as of r1464 by including the "imgPath" and 
"langPath" 
configuration options (see ConfigOptions for details). Will that suffice?

Original comment by adeve...@gmail.com on 16 Mar 2010 at 8:07

GoogleCodeExporter commented 9 years ago
sorry for the late response. i was on holidays :)
at the moment i don't find the time to test it seriously. but as i understand 
the fix
this will be sufficient. thanks very much!
thanks also for the documentation of the ConfigOptions. a small request, it 
would be
helpful if you could add a example of where to define this options within the
svg-editor.html. thank you.

Original comment by not.impo...@gmail.com on 25 Mar 2010 at 11:09