Seite 1 von 2

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

Verfasst: 09.05.2007 16:14
von Sarahlin
Komischer Titel aber ich weiß nicht wie es anders im Titel beschreiben soll.

Was mich sehr an phpBB störte war das zurückspringen des Cursors. Dies geschah wenn man einen BBCode Button drückte (ob makierter Text oder nicht). Am ende musste man somit bei langen Beiträgen im Editor von Zeile 1 wieder bis nach unten scrollen.

Das will ich nicht, wie löse ich dieses "nervigste" Problem?

mybb, vb kommen dagegen klar.

Verfasst: 09.05.2007 16:23
von nickvergessen
Also nach allen Künsten meiner Interpretation läuft es auf folgendes hinaus:
http://www.phpbb.de/viewtopic.php?t=131422

Verfasst: 09.05.2007 16:25
von Balint
Hallo!

Vielleicht auch im Zusammenhang mit diesem MOD:

http://www.phpbb.com/community/viewtopic.php?t=221270


Viele Grüße,
Bálint

Verfasst: 09.05.2007 16:52
von Sarahlin
Interessant, nun hab ich aber da ich erst dachte das Problem könne man mit einem besseren Editor-Mod lösen den Mod "bbcode box" installiert. Muss ich wieder zurück zum alten Editor oder gibt es auch schon für diese Version auch so ein Fix?

Verfasst: 09.05.2007 17:48
von nickvergessen
probiers mal mit dem gleichen falls das geht

Verfasst: 09.05.2007 18:08
von Sarahlin
nickvergessen hat geschrieben:Also nach allen Künsten meiner Interpretation läuft es auf folgendes hinaus:
http://www.phpbb.de/viewtopic.php?t=131422
Im dieses Problem handelt es sich anscheinend wirklich. Nur der Firefox scheint zu spinnen. Der Fix ist interessant und sicher toll realisierbar doch leider setze ich nun schon ein Mod ein der anstatt des Codes welchen man erweitern soll, auf eine Java Datei zugreift. (Brachland in meinem Kopf über Java).

BBCODE BOX heißt es.

Gibt es dafür auch schon so eine Art fix?

Verfasst: 09.05.2007 18:25
von Sarahlin
Toll, ich hab nun geschaut und leider war es mir nicht möglich die Anleitung wirklich zu befolgen.

Ich ging in die umgeleitete Java-Script Datei wo der anfang noch recht einfach war zu überarbeiten. Doch leider endete als er manche Suchbegriffe, Variabeln und Befehle nicht mehr fand.

Kennt ihr keine Möglichkeit? Fertige BBCode Box Fixes oder einen ähnlich guten BBCode-Editor der diesen code schon beinhaltet?

Verfasst: 10.05.2007 03:19
von Sarahlin
Oh der Mod den ich meine heißt: "Advanced BBCode Box"

Verfasst: 13.05.2007 20:35
von 4seven
Hallo erstmal

Ich schlage mich auch schon ziemlich lange mit diesem Problem herum, hab Tage damit verbracht, eigene Lösungen zu entwickeln und selbst der "Mozillafix für BBCode und Smilies beim Posten"
( http://www.phpbb.de/viewtopic.php?t=131 ... highlight= ) nützt da nichts, weil die zu ändernden Code-Anteile in einer BBCode-Box gemoddeten posting_body.tpl fehlen. Vielleicht hat ja jemand ne Lösung dafür parat.

Hier habe ich etwas gefunden, was 100% bei allen Browsern funktioniert.

http://www.massless.org/mozedit/

Da kann man alle Codes, durch Anpassungen des Quelltextes (Java und Html) auch alle BBCodes egal-wohin einfügen. Wäre vielleicht ein Ansatz für die Bastler unter euch oder den Autor der BBCode-Box.

Und genau das was dieses Beispiel realisiert, möchte ich. Die Smiles kann man bei der BBCode-Box (durch einen inzwischen eingepflegten CodeFix) ja auch schon im Firefox egal-wohin einfügen. Aber halt die BBCodes, wie URL , QUOTE usw, springen immer ans Ende der textarea im Firefox und nicht an die entsprechende Stelle im Text.

Vielleicht hat einer eine Idee. :grin:

Im Grunde sind 3 Dateien entscheidend:

add_bbcode.js + bbcode_box.js

unter ../mods/bbcode_box

..wobei Codeänderungen immer parallel in beiden Dateien gemacht werden müssen, damit der Code "greift"

und die ../templates/euer_template/posting_body.tpl


....wobei ich im Falle der BBCodeBox auf ein Änderung in den Java-Dateien tippe,
um das leidige Firefox-BBCode-Box-Problem zu fixen.

Also irgendwie müssen doch die "guten Anteile" des Beispielcodes hier
http://www.massless.org/mozedit/
in die Java-Datein der BBCodeBox integrierbar sein. *grübel

*

Verfasst: 14.05.2007 06:30
von Tompom
Hallo,

ich habe das Problem mit dem hüpfenden Mozilla Browser und dem Template subBlack so gelöst (Code varriert leicht zu dem verlinkten).
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl

#
#-----[ FIND ]------------------------------------------
#
// Shows the help messages in the helpline window

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
var baseHeight;
function initInsertions() {
if (is_ie && typeof(baseHeight) != 'number') baseHeight = document.selection.createRange().duplicate().boundingHeight;
}
// End add - BBCodes & smilies enhancement MOD

#
#-----[ FIND ]------------------------------------------
#
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
txtarea.focus();

#
#-----[ REPLACE WITH ]------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
// End add - BBCodes & smilies enhancement MOD
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
txtarea.focus();
// Start add - BBCodes & smilies enhancement MOD
} else
if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
{
mozInsert(txtarea, text, "");
return;
// End add - BBCodes & smilies enhancement MOD

#
#-----[ FIND ]------------------------------------------
#
if (!theSelection) {

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
var text = bbopen + bbclose;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else
// End add - BBCodes & smilies enhancement MOD

#
#-----[ FIND ]------------------------------------------
#
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, bbopen, bbclose);

#
#-----[ REPLACE WITH ]------------------------------------------
#
// Start replacement - BBCodes & smilies enhancement MOD
else if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
{
mozInsert(txtarea, bbopen, bbclose);
// End replacement - BBCodes & smilies enhancement MOD

#
#-----[ FIND ]------------------------------------------
#
while (bbcode[0]) {
butnumber = arraypop(bbcode) - 1;

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
var text = bbtags[butnumber + 1];
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else
if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
{
mozInsert(txtarea, bbtags[butnumber + 1], "");
} else
// End add - BBCodes & smilies enhancement MOD

#
#-----[ FIND ]------------------------------------------
#
mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);

#
#-----[ REPLACE WITH ]------------------------------------------
#
mozInsert(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);

#
#-----[ FIND ]------------------------------------------
#
while (bbcode[bblast]) {
butnumber = arraypop(bbcode) - 1;

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
var text = bbtags[butnumber + 1];
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else
if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
{
mozInsert(txtarea, bbtags[butnumber + 1], "");
} else
// End add - BBCodes & smilies enhancement MOD

#
#-----[ FIND ]------------------------------------------
#
if (imageTag && (bbnumber != 14)) { // Close image tag before adding another

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
var text = bbtags[15];
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else
if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
{
mozInsert(txtarea, bbtags[15], "");
} else
// End add - BBCodes & smilies enhancement MOD

#
#-----[ FIND ]------------------------------------------
#
// Open tag

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
if (bbnumber == 16) {
var url = prompt("{L_BBCODE_URL}", "http://");

if (url == null) {
return;
} else if (!url) {
alert("{L_BBCODE_URL_ERRORS}" + "\n" + "\n" + "{L_BBCODE_URL_EMPTY}");
return;
} else {
var title = prompt("{L_BBCODE_URL_TITLE}", "");

if (title == null) {
return;
} else if (!title) {
var text = "" + url + "";
} else {
var text = "" + title + "";
}
}

if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else
if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
{
mozInsert(txtarea, text, "");
} else txtarea.value += text;
} else {
var text = bbtags[bbnumber];
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else
if ((txtarea.selectionEnd | txtarea.selectionEnd == 0) && (txtarea.selectionStart | txtarea.selectionStart == 0))
{
mozInsert(txtarea, bbtags[bbnumber], "");
} else
// End add - BBCodes & smilies enhancement MOD

#
#-----[ FIND ]------------------------------------------
#
eval('document.post.addbbcode'+bbnumber+'.value += "*"');

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
}
// End add - BBCodes & smilies enhancement MOD

#
#-----[ FIND ]------------------------------------------
#
//-->
</script>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start add - BBCodes & smilies enhancement MOD
function mozInsert(txtarea, openTag, closeTag)
{
var scrollTop = ( typeof(txtarea.scrollTop) == 'number' ? txtarea.scrollTop : -1 );

if (txtarea.selectionEnd > txtarea.value.length) { txtarea.selectionEnd = txtarea.value.length; }

var startPos = txtarea.selectionStart;
var endPos = txtarea.selectionEnd+openTag.length;

txtarea.value=txtarea.value.slice(0,startPos)+openTag+txtarea.value.slice(startPos);
txtarea.value=txtarea.value.slice(0,endPos)+closeTag+txtarea.value.slice(endPos);

txtarea.selectionStart = startPos+openTag.length;
txtarea.selectionEnd = endPos;
txtarea.focus();

if( scrollTop >= 0 ) { txtarea.scrollTop = scrollTop; }
}
// End add - BBCodes & smilies enhancement MOD

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