[Editor] Bei drücken eines Buttons cursor nach oben springt

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
4seven
Mitglied
Beiträge: 5869
Registriert: 21.04.2007 06:18

Beitrag von 4seven »

Danke für den Ansatz, Tompom

Aber diese Lösung, wie ich oben schon anschnitt, greift bei einer, mit der BBcodeBox gemoddeten posting_body.tpl nicht, da die zu aktualisierenden Codeteile schlicht nicht (mehr) vorhanden sind.

Anyway, nachdem ich mir eine weitere Nacht um die Ohren geschlagen habe, hab ich nun die Lösung im Netz gefunden und etwas modifiziert, da die Lösung für die BBcodeBox auf einer älteren Version aufsetzte und nicht mehr relevant war.

Hier erstmal noch eine alternative Lösung für ein Standard PHPBB (ohne BBCodeBox)
als Ansatz, falls der normale Code des Firefox-Snippets
http://www.phpbb.de/viewtopic.php?t=131422
bei dem ein oder anderen nicht greifen sollte:

Code: Alles auswählen

##############################################################
## MOD Title: Accurate BBCode Insertion Mod
## MOD Version: 1.0.1
## MOD Author: Lord Z
## MOD Description: This mod will insert BBCode accuratly into a post, (at the caret position) instead of putting it at the bottom.
##############################################################
#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/posting_body.tpl

#
#-----[ FIND ]------------------------------------------
#
function emoticon(text) {

#
#-----[ BEFORE, ADD ]------------------------------------------
#

function bbplace(text) {
    var txtarea = document.post.message;
    if (txtarea.createTextRange && txtarea.caretPos) {
        var caretPos = txtarea.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
        txtarea.focus();
    } else if (txtarea.selectionStart || txtarea.selectionStart == '0') {
        var startPos = txtarea.selectionStart;
        var endPos = txtarea.selectionEnd;
        txtarea.value = txtarea.value.substring(0, startPos)
                      + text
                      + txtarea.value.substring(endPos, txtarea.value.length);
        txtarea.focus();
        txtarea.selectionStart = startPos + text.length;
        txtarea.selectionEnd = startPos + text.length;
    } else {
        txtarea.value  += text;
        txtarea.focus();
    }
}

#
#-----[ FIND ]------------------------------------------
#
# This is in the function emoticon(text)

    } else {
            txtarea.value  += text;
            txtarea.focus();

#
#-----[ REPLACE WITH ]------------------------------------------
#

    } else {
            bbplace(text);
            txtarea.focus();
           
#
#-----[ FIND ]------------------------------------------
#
      while (bbcode[bblast]) {
            butnumber = arraypop(bbcode) - 1;
            txtarea.value += bbtags[butnumber + 1];

#
#-----[ REPLACE WITH ]------------------------------------------
#

      while (bbcode[bblast]) {
            butnumber = arraypop(bbcode) - 1;
            bbplace(bbtags[butnumber + 1]);

#
#-----[ FIND ]------------------------------------------
#
      if (imageTag && (bbnumber != 14)) {      // Close image tag before adding another
         txtarea.value += bbtags[15];

#
#-----[ REPLACE WITH ]------------------------------------------
#

      if (imageTag && (bbnumber != 14)) {      // Close image tag before adding another
         bbplace(bbtags[15]);

#
#-----[ FIND ]------------------------------------------
#
      // Open tag
      txtarea.value += bbtags[bbnumber];

#
#-----[ REPLACE WITH ]------------------------------------------
#
      // Open tag
      bbplace(bbtags[bbnumber]);

#
#----[ FIND  ]------------------------------------------
#

   if (donotinsert) {      // Close all open tags up to the one just clicked & default button names
         while (bbcode[bblast]) {
               butnumber = arraypop(bbcode) - 1;
               txtarea.value += bbtags[butnumber + 1];

#
#----[ REPLACE BY ]------------------------------------------
#

   if (donotinsert) {      // Close all open tags up to the one just clicked & default button names
         while (bbcode[bblast]) {
               butnumber = arraypop(bbcode) - 1;
               bbplace(bbtags[butnumber + 1]);

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#

Und hier der Fix für die BBCodeBox (getestet mit BBCode Box v5.1.0):

Code: Alles auswählen

#
#-----[ OPEN ]------------------------------------------
#

bbcode_box/add_bbcode.js + bbcode_box/bbcode_box.js

#
# >>>>    Note: All changes make in both files <<<<<
# >>>> Wichtig: Alle Änderungen in beiden Dateien machen <<<<
#

#
#-----[ FIND ]------------------------------------------
#
function BBCplain() {

#
#-----[ BEFORE, ADD ]------------------------------------------
#
function bbplace(text) {
    var txtarea = document.post.message;
    if (txtarea.createTextRange && txtarea.caretPos) {
        var caretPos = txtarea.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? 

caretPos.text + text + ' ' : caretPos.text + text;
        txtarea.focus();
    } else if (txtarea.selectionStart || txtarea.selectionStart == '0') {
        var startPos = txtarea.selectionStart;
        var endPos = txtarea.selectionEnd;
        txtarea.value = txtarea.value.substring(0, startPos)
                      + text
                      + txtarea.value.substring(endPos, txtarea.value.length);
        txtarea.focus();
        txtarea.selectionStart = startPos + text.length;
        txtarea.selectionEnd = startPos + text.length;
    } else {
        txtarea.value  += text;
        txtarea.focus();
    }
}

#
#-----[ FIND ALL ]------------------------------------------
#
document.post.message.value+=ToAdd;

#
#-----[ REPLACE ALL WITH ]-------------------------------------
#

bbplace(ToAdd);

#
#-----[ FIND ALL ]--------------------------------------------------
#

txtarea.value += bbopen + bbclose;

#
#-----[ REPLACE ALL WITH ]------------------------------------------
#

bbplace(bbopen + bbclose);

#
#-----[ FIND ALL ]--------------------------------------------------
#

document.post.message.value += text;

#
#-----[ REPLACE ALL WITH ]------------------------------------------
#

bbplace(text);

#
#-----[ THATS IT ]---------------------------------------------
#
*
Tompom
Mitglied
Beiträge: 72
Registriert: 04.02.2007 14:36
Wohnort: Gau Bischofsheim
Kontaktdaten:

Beitrag von Tompom »

Hallo,

na ja bei mir hat es funktioniert und da dachte ich mir, wenn ein blindes Hühnchen mal durch Zufall ein Korn findet dann sollte er es posten, könnte ja sein das es bei jemand anderem auch funzt :lol:
Tschüss
Daniel
4seven
Mitglied
Beiträge: 5869
Registriert: 21.04.2007 06:18

Beitrag von 4seven »

Hallo Tompom,

naaa, das war schon klasse mit dem Tip, weil der Standard Firefox-Fix bei einem, nicht mit der BBCodeBox gemoddeten Forum, ja (meistens) hilft. Da er aber nicht immer hilft, hab ich noch ne Alternativlösung gepostet.

Dem Threadersteller war aber der BBCodeBox-Firefox-Fix wichtig.

Vielleicht könnte man auch den Titel des Threads ändern, weil, wie ich weiß, schlagen sich ne Menge Leute damit rum und ich mußte selbst Wochen suchen, Code probieren und umstellen, um die Lösung zu finden. Noch dazu ist das Support-Forum und damit der Autor der BBCodeBox im Augenblick Off.

lg
Antworten

Zurück zu „phpBB 2.0: Mod Support“