wiki-links: one fix and one problem

Creating and modifying plugins.
Post Reply
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

wiki-links: one fix and one problem

Post by stm999999999 »

hello,

happy new year to all! :-)

I worked at the wikilinks-plugin:

a) the fix:

in the lang_en.inc.php the "?>" at the end is missed

b) I make a translation to german:

Code: Select all

<?php # $Id: lang_de.inc.php,v 1.4 2006/12/31 21:32:53 elf2000 Exp $


@define('PLUGIN_EVENT_WIKILINKS_NAME', 'Free Wiki Links für Einträge');
@define('PLUGIN_EVENT_WIKILINKS_DESC', 'Ermöglicht Links zu blog-internen Einträgen via [[Title]], Links zu Statischen Seiten via ((Title)) und einen Link zu beidem via {{Title}}. Zudem wird ein Button zu internen Einträgen bereitgestellt.');
@define('PLUGIN_EVENT_WIKILINKS_IMGPATH', 'Pfad zu den Bildern');
@define('PLUGIN_EVENT_WIKILINKS_IMGPATH_DESC', 'Bitte Pfad zu den Wikilink-bearbeiten-Icons eingeben.');

@define('PLUGIN_EVENT_WIKILINKS_EDIT_INTERNAL', 'Bearbeite Blog-Eintrag');
@define('PLUGIN_EVENT_WIKILINKS_EDIT_STATICPAGE', 'Bearbeite Statische Seite');
@define('PLUGIN_EVENT_WIKILINKS_CREATE_INTERNAL', 'Erstelle Blog-Eintrag');
@define('PLUGIN_EVENT_WIKILINKS_CREATE_STATICPAGE', 'Erstelle Statische Seite');

@define('PLUGIN_EVENT_WIKILINKS_LINKENTRY', 'Link zu Eintrag');
@define('PLUGIN_EVENT_WIKILINKS_LINKENTRY_DESC', 'Bitte wähle den Eintrag aus, zu dem gelinkt werden soll.');

?>
The converting to UTF-8 did not work for me, please do it for me

c) the problem:

when I have marked a word in the text and click to the "link to entry" button the link allways goes to the end of the text and not around the marked word!
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: wiki-links: one fix and one problem

Post by garvinhicking »

Hi!
in the lang_en.inc.php the "?>" at the end is missed
Those are optional. We do not usually include them in our files.

I committed your translations, many thanks!
when I have marked a word in the text and click to the "link to entry" button the link allways goes to the end of the text and not around the marked word!
Yes, this part of the code is responsible:

Code: Select all

        if (txtarea.createTextRange && txtarea.caretPos) {
            caretPos = txtarea.caretPos;
            caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + ' ' + txt + ' ' : caretPos.text + ' ' + txt + ' ';
        } else {
            txtarea.value  += ' ' + txt + ' ';
        }
I believe the createTextRange thing only works in IE (or only in FF, don't remember). If you can supply a working, small cross-browser implementation I could commit it? I believe something cross-browser is already in the serendipity_editor.js script, but I'm currently too short in time to look into that. Maybe later this month! :-)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: wiki-links: one fix and one problem

Post by stm999999999 »

garvinhicking wrote:Hi!

I committed your translations, many thanks!
Please can you give a new version number to the plugin, so the update via spartacus is possible?
Ciao, Stephan
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: wiki-links: one fix and one problem

Post by stm999999999 »

garvinhicking wrote: I believe the createTextRange thing only works in IE (or only in FF, don't remember). If you can supply a working, small cross-browser implementation I could commit it? I believe something cross-browser is already in the serendipity_editor.js script, but I'm currently too short in time to look into that.
the normal editor-code does not work proper, neither. :-( There are (for me) several problems:

every time I use a button with no selected text ...

a little excursion: when I select text and make it <em> or URL e.g. it works fine

... but such a button (em, bold, "", URL ...) without text or a button where no text can be selected (&,', ) every time the inserted text is at the end of the text! :-(

So, I want to add a new sentence in the middle of an existing text, but a & in this sentence get to the text end. :-(

all this is in Opera 9.x and IE7

very interesting: In FF the situation is different:

all works on the place of the cursor (not added to the end as with Opera/IE). but not "Link to entry".[/img][/list]
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: wiki-links: one fix and one problem

Post by garvinhicking »

Hi!

Sadly I'm not into JS too deep right now, but it is technically a large difference if you select text or if you don't. :(

But I bumped the plugin version. *g*

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: wiki-links: one fix and one problem

Post by stm999999999 »

garvinhicking wrote:Hi!

Sadly I'm not into JS too deep right now, but it is technically a large difference if you select text or if you don't. :(
I am not deep into it, too :-( But is there nothing like actualCursorPosition()?


And thanks for the version bump.
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: wiki-links: one fix and one problem

Post by garvinhicking »

Hi!
I am not deep into it, too :-( But is there nothing like actualCursorPosition()?
There is, but it's different for IE5, IE6, Mozilla < 1.4, Mozilla > 1.4, Opera and Konqueror.

So you'll need to if/else/switch/case about 4 different function calls, AFAIR.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: wiki-links: one fix and one problem

Post by stm999999999 »

garvinhicking wrote:
There is, but it's different for IE5, IE6, Mozilla < 1.4, Mozilla > 1.4, Opera and Konqueror.
Arggghhh :x
Ciao, Stephan
Post Reply