(2024-03-10, 11:54 PM)meisme Wrote: [ -> ]Looks like what i want. I will try to implement it.
the sceditor documentation is such a ***** docu
I found a place in "codebuttons" where i put the "plaintext" behind the "undo" plugin
and that works with the copy/pasted text from websites, but now my textarea isnt width=100% anymore
how can i bring back the width?
no, this "plaintext" isnt good cause it take away all the codebuttons and also smilies dont work with it
I don't know and can't check (as I can't re-create the problem .... but I know folk who have the issue) if this will help!
I think the "Plain Text" plugin from ScEditor is not working as it is being over written by another file (same thing happening with me on a different issue).
In "bbcodes_sceditor.js" .... at line 153 (up to line 239) you will find this code which changes the default actions of sceditor:
// Update size tag to use xx-small-xx-large instead of 1-7
$.sceditor.formats.bbcode.set('size', {
format: function ($elm, content) {
var fontsize = 1,
scefontsize = $($elm).data('scefontsize'),
parsed = parseInt(scefontsize, 10),
size = parseInt($($elm).attr('size'), 10),
iframe = $('.sceditor-container iframe'),
editor_body = $('body', iframe.contents());
if ($($elm).css('font-size') == editor_body.css('font-size')) {
// Eliminate redundant [size] tags for unformatted text.
// Part of the fix for the browser-dependent bug of issue #4184.
// Also fixes the browser-dependent bug described here:
// <https://community.mybb.com/thread-229726.html>
fontsize = -1;
} else if (!isNaN(size) && size >= 1 && size <= mybbCmd.fsStr.length) {
fontsize = mybbCmd.fsStr[size - 1];
} else if ($.inArray(scefontsize, mybbCmd.fsStr) !== -1) {
fontsize = scefontsize;
} else if (!isNaN(parsed)) {
fontsize = parsed;
}
return fontsize != -1 ? '[size=' + fontsize + ']' + content + '[/size]' : content;
},
html: function (token, attrs, content) {
var size = 0,
units = "",
parsed = parseInt(attrs.defaultattr, 10);
if (!isNaN(parsed)) {
size = parsed;
if (size < 1) {
size = 1;
} else if (size > 50) {
size = 50;
}
units = "pt";
} else {
var fsStrPos = $.inArray(attrs.defaultattr, mybbCmd.fsStr);
if (fsStrPos !== -1) {
size = attrs.defaultattr;
}
}
return '<font data-scefontsize="' + $.sceditor.escapeEntities(attrs.defaultattr) + '" style="font-size: ' + size + units + ';">' + content + '</font>';
}
});
$.sceditor.command.set('size', {
_dropDown: function (editor, caller, callback) {
var content = $('<div />'),
clickFunc = function (e) {
callback($(this).data('size'));
editor.closeDropDown(true);
e.preventDefault();
};
for (var i = 1; i <= 7; i++)
content.append($('<a class="sceditor-fontsize-option" data-size="' + i + '" href="#"><font style="font-size: ' + mybbCmd.fsStr[i-1] + '">' + i + '</font></a>').on('click', clickFunc));
editor.createDropDown(caller, 'fontsize-picker', content.get(0));
},
exec: function (caller) {
var editor = this;
$.sceditor.command.get('size')._dropDown(
editor,
caller,
function (fontSize) {
editor.execCommand('fontsize', fontSize);
}
);
},
txtExec: function (caller) {
var editor = this;
$.sceditor.command.get('size')._dropDown(
editor,
caller,
function (size) {
size = (~~size);
size = (size > 7) ? 7 : ((size < 1) ? 1 : size);
editor.insertText('[size=' + mybbCmd.fsStr[size - 1] + ']', '[/size]');
}
);
}
});
As you can see from the starting comment "Update size tag to use xx-small-xx-large instead of 1-7" .... it is changing the way the sceditor interacts with font size!
This was first introduced in MyBB version 1.8.23 but the sceditor version now in 1.8.37 is a newer version (but not the most updated) .... I think that old code is conflicting with your "Plain Text" plugin (or maybe you just won't need the plugin .... if you remove that above code from the "bbcodes_sceditor.js" file???).
I wish that I could test it but I can't make it happen to me
Please only test this out on your test forum .... just delete it from the file and see what happens (you can always paste it back in)
As said .... I can't test it but I did just remove that block of code from the file!
Before removal and viewing source mode:
[
attachment=46775]
After removing the code:
[
attachment=46774]
So you can see that maybe pasting in text (sometimes) is looked at incorrectly .... but I don't know lol