1
Modifications Talk / Re: Clipboard image support for the editor
« on: January 24, 2024, 03:07:25 pm »
Hmmm... what I found somewhere else...
Preinfo:
However the file "*smfpack*.js" doesn't exist - I found the quote inside "jquery.sceditor.smf.js" instead.
Preinfo:
However the file "*smfpack*.js" doesn't exist - I found the quote inside "jquery.sceditor.smf.js" instead.
Code: [Select]
Hi I have a quick little patch you can do to improve the SMFPacks WYSIWYG Editor. Many thanks to Sam Clarke, the author of the SCEditor for helping me with this! Please proceed at your own risk.
The SCEditor is the underlying editor code that the SMF Packs editor uses, its basically the heart of this mod. Updating it fixes many issues this mod has that have gone unresolved.
Download the latest SCEditor code here: Releases · samclarke/SCEditor · GitHub
Unzip it, open the "minified" folder and copy the "jquery.sceditor.bbcode.min.js" and "plugins" folders to your desktop.
Go to your forum files open /Themes/default/scripts/advanced_editor
Replace the "jquery.sceditor.bbcode.min.js" and plugins folders with the new ones from your desktop.
Open jquery.sceditor.smfpacks.js in a text editor and make these edits
Find:
CodeSelect
sceditor.formats.bbcode.set(
'quote', {
Replace
sceditor.formats.bbcode.set(
'quote', {
tags: {
blockquote: null,
cite: null
},
quoteType: $.sceditor.BBCodeParser.QuoteType.never,
breakBefore: false,
isInline: false,
format: function (element, content) {
var element = $(element);
var author = '';
var date = '';
var link = '';
// The <cite> contains only the graphic for the quote, so we can skip it
if (element[0].tagName.toLowerCase() === 'cite')
return '';
// Changed these to use data- attributes
if (element.attr('data-author'))
author = ' author=' + element.attr('data-author').php_unhtmlspecialchars();
if (element.attr('data-link'))
link = ' link=' + element.attr('data-link');
if (element.attr('data-date'))
date = ' date=' + element.attr('data-date');
return '[quote' + author + link + date + ']' + content + '[/quote]';
},
html: function (element, attrs, content) {
var attr_author = '', author = '';
var attr_date = '', sDate = '';
var attr_link = '', link = '';
if (typeof attrs.author !== "undefined" && attrs.author)
{
attr_author = attrs.author;
author = bbc_quote_from + ': ' + attr_author;
}
// Links could be in the form: link=topic=71.msg201#msg201 that would fool javascript, so we need a workaround
// Probably no more necessary
for (var key in attrs)
{
if (key.substr(0, 4) == 'link' && attrs.hasOwnProperty(key))
{
var attr_link = key.length > 4 ? key.substr(5) + '=' + attrs[key] : attrs[key];
link = attr_link.substr(0, 7) == 'http://' ? attr_link : smf_scripturl + '?' + attr_link;
author = author == '' ? '<a href="' + link + '">' + bbc_quote_from + ': ' + link + '</a>' : '<a href="' + link + '">' + author + '</a>';
}
}
if (typeof attrs.date !== "undefined" && attrs.date)
{
attr_date = attrs.date;
tDate = new Date(attr_date * 1000);
sDate_string = tDate.toLocaleString();
sDate = '<date timestamp="' + attr_date + '">' + sDate_string + '</date>';
}
if (author == '' && sDate == '')
author = bbc_quote;
else if (author == '' && sDate != '')
author += ' ' + bbc_search_on;
// Changed this to use data- attributes
content = '<blockquote data-author="' + attr_author + '" data-date="' + attr_date + '" data-link="' + attr_link + '"><cite>' + author + ' ' + sDate + '</cite>' + content + '</blockquote>';
return content;
}
}
);