This feature has been requested, but by default xenforo does not work this way.When I select a text in a post and then click in the quote button in the editor, should this text get into the editor?
This feature has been requested, but by default xenforo does not work this way.
+ selection.getContent().replace(/^<p>/, '').replace(/<\/p>$/, '')
+ window.getSelection()
http://xenforo.com/community/threads/suggestion-quote-selected-text.87/page-3#post-279472selectable quoting.
http://xenforo.com/community/threads/suggestion-quote-selected-text.87/page-3#post-279472
By the sounds of it ... someone tried to accomplish this.
Let me know when you get it working so I can experiment further.I just got it working, with images and formating...I will make some tests...
Thanks again!
Fuhrmann: if your code is clean maybe Kier would slip it into xF 1.1 (not likely mind you)Kier said:March 13, 2011: It's something I've been playing with, but there is no generally agreed format for addressing the selection within a document, so this kind of feature tends to be extremely fragile.
Looks good
Screencast-o-matic is cool as well.I've always wanted to see a forum "screenshot tool" that bypasses the local PC (ie. you can grab from the screen and post online without saving it locally).Almost feels like this could do that.
/*
* The following functions are bespoke and thus covered by a proprietary license.
*/
(function() {
var wrapBbCode = function(editor, tag)
{
var selection = editor.selection,
content, range, caret;
var range = window.getSelection().getRangeAt(0);
var startContainer = range.startContainer;
var spanNode = startContainer.ownerDocument.createElement("layer");
var docfrag = range.extractContents();
console.log(startContainer.parentNode);
spanNode.appendChild(docfrag);
range.insertNode(spanNode);
content = '[' + tag + ']'
+ spanNode.innerHTML
+ '<span id="__xfBbCaret">_</span>'
+ '[/' + tag + ']';
content = '<p>' + content + '</p>';
selection.setContent(content);
if (editor.getDoc().createRange)
{
caret = editor.dom.get('__xfBbCaret');
range = editor.getDoc().createRange();
range.setStartBefore(caret);
range.setEndBefore(caret);
selection.setRng(range);
}
editor.dom.remove('__xfBbCaret');
};
Any reports of people using it ?
I've tried to implement this, but when I select something to quote and click the quote button, the post I'm quoting from get a line break inserted before and after the selected text. When I refresh the page that is restored though, but still, it's not a desired behavior. But I am glad you are working on this, a much "needed" function on my forum, since my users have had this function in my previous SMF installation.Not to me!
I've tried to implement this, but when I select something to quote and click the quote button, the post I'm quoting from get a line break inserted before and after the selected text. When I refresh the page that is restored though, but still, it's not a desired behavior. But I am glad you are working on this, a much "needed" function on my forum, since my users have had this function in my previous SMF installation.
We use essential cookies to make this site work, and optional cookies to enhance your experience.