inherit
168679
0
Nov 18, 2012 17:03:07 GMT -8
Virgil Sovereign
Latet anguis in herba.
686
July 2011
syonidv
|
Post by Virgil Sovereign on Dec 27, 2015 16:46:50 GMT -8
Attn: Chris and Other Devs I've run into the following problem a few times. I need to embed an element in outgoing post BBCode/HTML in such a way that both: - the element does not appear in the layout when the page is loaded, even when no scripts are run
- Proboards' backend can convert the element between BBCode and HTML
The issue is that I need to store content in outgoing posts in such a way that if a post is quoted or edited, both the HTML (in the proboards.dataHash.visualHtml variable) and the BBCode (in the value of the text editor) contain appropriately-translated versions of the content, but the content must not be present in the layout of the published post.
Ordinarily I would use keys or embedded <font size="URL-encoded-content"></font> tags, but these are not converted by Proboards' backend. At best, they require an AJAX call or primitive translation when the post is being loaded into the editor in a format different from the one in which it was saved.
Ideally, it would be nice if the Proboards HTML-BBCode parser/translator permitted the style="display:none;" attribute for divs. Is this doable? Is there another workaround I'm missing? Many thanks for any help or assistance you can provide.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Dec 27, 2015 16:52:40 GMT -8
Can you not use a span or div and use the title attribute to store your data in?
[span title="hello world"][/span]
|
|
inherit
168679
0
Nov 18, 2012 17:03:07 GMT -8
Virgil Sovereign
Latet anguis in herba.
686
July 2011
syonidv
|
Post by Virgil Sovereign on Dec 27, 2015 16:55:42 GMT -8
Can you not use a span or div and use the title attribute to store your data in? [span title="hello world"][/span] The data itself is arbitrary BBCode/HTML content. Generally speaking, it can't be stored in an attribute unencoded. I could URL encode the data, but then Proboards' backend doesn't translate it.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Dec 27, 2015 17:15:51 GMT -8
Can you not use a span or div and use the title attribute to store your data in? [span title="hello world"][/span] The data itself is arbitrary BBCode/HTML content. Generally speaking, it can't be stored in an attribute unencoded. I could URL encode the data, but then Proboards' backend doesn't translate it. The problem you have is that the element holding on to that data will get converted into its HTML equivalent (span in this case), and the data stored in the attribute will get converted to its UBBC equivalent. So you will need to convert them back when editing a post, or switching from BBC to visual. Bit of a pain, but that's the only way around it if you want the backend to handle parsing.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,986
December 2005
horace
Wormo's Mini-Profile
|
Post by Chris on Dec 27, 2015 17:43:51 GMT -8
The parser does not permit "display:none" but it does support setting width and height to 1px with an overflow of hidden. Quote this post to see the hidden text below: Attn: Chris and Other Devs I've run into the following problem a few times. I need to embed an element in outgoing post BBCode/HTML in such a way that both: - the element does not appear in the layout when the page is loaded, even when no scripts are run
- Proboards' backend can convert the element between BBCode and HTML
The issue is that I need to store content in outgoing posts in such a way that if a post is quoted or edited, both the HTML (in the proboards.dataHash.visualHtml variable) and the BBCode (in the value of the text editor) contain appropriately-translated versions of the content, but the content must not be present in the layout of the published post.
Ordinarily I would use keys or embedded <font size="URL-encoded-content"></font> tags, but these are not converted by Proboards' backend. At best, they require an AJAX call or primitive translation when the post is being loaded into the editor in a format different from the one in which it was saved.
Ideally, it would be nice if the Proboards HTML-BBCode parser/translator permitted the style="display:none;" attribute for divs. Is this doable? Is there another workaround I'm missing? Many thanks for any help or assistance you can provide.
|
|
inherit
168679
0
Nov 18, 2012 17:03:07 GMT -8
Virgil Sovereign
Latet anguis in herba.
686
July 2011
syonidv
|
Post by Virgil Sovereign on Dec 27, 2015 17:51:37 GMT -8
The data itself is arbitrary BBCode/HTML content. Generally speaking, it can't be stored in an attribute unencoded. I could URL encode the data, but then Proboards' backend doesn't translate it. The problem you have is that the element holding on to that data will get converted into its HTML equivalent (span in this case), and the data stored in the attribute will get converted to its UBBC equivalent. So you will need to convert them back when editing a post, or switching from BBC to visual. Bit of a pain, but that's the only way around it if you want the backend to handle parsing. Right. This thread is basically a request for a workaround or for the attribute I mentioned in the OP to lessen the pain. "Bit of a pain" is actually "considerable pain" since the only solution I can see is to write my own crippled client-side HTML/BBCode validator/converter. The AJAX option is messy. It either requires an AJAX request to be fired off immediately before the post is submitted, and two URL-encoded versions of the content to be stored in the post. Or it requires firing off an AJAX request when the post is first loaded into the editor, which I believe technically breaks the developer guidelines. Either way, we have plugins firing off AJAX requests they really don't need to make. The homebrew HTML/BBCode converter is doable, but at the very least this approach requires a plugin to "manually" strip anything potentially malicious out of BBCode/HTML, which takes no small bit of logic to do properly, and it won't properly convert elements like user links, quotes, videos, etc., because these all require information from the backend. It would be vastly simpler if we had a style="display:none;" attribute to make use of. No AJAX calls. No crippled, XSS-attack-waiting-to-happen homebrew content validators/converters. No hackish empty tags with URL-encoded title attributes. I admittedly don't know what the Proboards code base looks like, but I can't imagine that adding style="display:none;" to the list of allowable DIV attributes on the next build would take more than 20 minutes. In any case, I'd appreciate it, for what that's worth.
|
|
inherit
168679
0
Nov 18, 2012 17:03:07 GMT -8
Virgil Sovereign
Latet anguis in herba.
686
July 2011
syonidv
|
Post by Virgil Sovereign on Dec 27, 2015 17:52:38 GMT -8
The parser does not permit "display:none" but it does support setting width and height to 1px with an overflow of hidden. Quote this post to see the hidden text below: Attn: Chris and Other Devs I've run into the following problem a few times. I need to embed an element in outgoing post BBCode/HTML in such a way that both: - the element does not appear in the layout when the page is loaded, even when no scripts are run
- Proboards' backend can convert the element between BBCode and HTML
The issue is that I need to store content in outgoing posts in such a way that if a post is quoted or edited, both the HTML (in the proboards.dataHash.visualHtml variable) and the BBCode (in the value of the text editor) contain appropriately-translated versions of the content, but the content must not be present in the layout of the published post.
Ordinarily I would use keys or embedded <font size="URL-encoded-content"></font> tags, but these are not converted by Proboards' backend. At best, they require an AJAX call or primitive translation when the post is being loaded into the editor in a format different from the one in which it was saved.
Ideally, it would be nice if the Proboards HTML-BBCode parser/translator permitted the style="display:none;" attribute for divs. Is this doable? Is there another workaround I'm missing? Many thanks for any help or assistance you can provide. Ha! Good enough! Many thanks!
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Dec 28, 2015 1:53:26 GMT -8
Virgil Sovereign , My bad. It seems I didn't fully understand what you were trying to do. Edit: Then again, maybe I did, and missed the simple solution lol. *thumbs up to Chris*
|
|