Commit 5500facc authored by Volker Krause's avatar Volker Krause
Browse files

Pass the triggering node to the extractor script as a third argument

This is needed to phase out the global Context object, which is what we
use so far to convey information about the triggering data.
parent a789129e
......@@ -108,7 +108,11 @@ ExtractorResult ExtractorScriptEngine::execute(const ScriptExtractor *extractor,
qCDebug(Log) << "Running script extractor" << extractor->scriptFileName() << extractor->scriptFunction();
const auto engineReset = qScopeGuard([&node]{ node.setScriptEngine(nullptr); });
const auto engineReset = qScopeGuard([&node, &triggerNode]{
// ### legacy context API, replace that by passing trigger node as a third argument eventually
if (triggerNode.result().isEmpty()) {
......@@ -142,7 +146,8 @@ ExtractorResult ExtractorScriptEngine::execute(const ScriptExtractor *extractor,
const auto nodeArg = d->m_engine.toScriptValue(node);
const auto dataArg ="content"));
QJSValueList args{ dataArg, nodeArg };
const auto triggerArg = d->m_engine.toScriptValue(triggerNode);
QJSValueList args{ dataArg, nodeArg, triggerArg };
const auto result =;
if (result.isError()) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment