Closed bgailer closed 3 months ago
Makes sense. This will be fixed to not use the whole body
from the sanitiser parsing logic and only the contents.
Side note: the new [[quid/]]
-block may be handy if you need to keep your identifiers unique:
<span id="[[quid id='source'/]]">hello</span>
[[javascript]]
stack_js.get_content("[[quid id='source'/]]").then((content) => {
stack_js.switch_content("[[quid id='target'/]]", content);
});
[[/javascript]]
<span id="[[quid id='target'/]]">content should go here</span>
Basically, if you find yourself copying the same pattern everywhere and have the risk of multiple questions on the same page using the same identifiers, then this might be useful.
I've got a side issue: the new [[quid/]]
block sounds really useful, but it's not working for me. When I try to use it on the stack-demo site, I get an error message when saving the question: "Unknown block of type quid requested". Searching on github doesn't show up anything in the code defining [[quid/]]
, so am I right in thinking this feature is still a work in progress?
It will come out with 4.6, there has not been a release since this was created.
It does exist in the dev branch, though... Simply dropping that single file into any 4.5+ level install should work.
Great, thanks!
Hello,
we have been using a lot of the new STACK-JS features recently and the functions to interact with the question content from inside the iframes are really helpful. One thing I noticed, when using the function
stack_js.switch_content
to change the content of an HTML element with an id like for example "target", then the content "hello" shows up enclosed by a HTML body tag.For example, if I have
then the target span is
which results in a different layout (block-level) and style of the target span than before. Instead, it should be just
<span id="target">hello</span>
in my opinion. Maybe this comes from parsing the content in the stackjsvle script.