Files
nextcloud-collabora-nodered/nodes/collabora-transform.html
T

50 lines
1.9 KiB
HTML
Raw Normal View History

<script type="text/javascript">
RED.nodes.registerType('collabora-transform', {
category: 'nextcloud collabora',
color: '#7950a2',
defaults: {
name: { value: '' },
config: { type: 'nc-collab-config', required: true }
},
inputs: 1,
outputs: 1,
icon: 'font-awesome/fa-magic',
label: function () {
return this.name || 'transform structure';
}
});
</script>
<script type="text/html" data-template-name="collabora-transform">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-config"><i class="fa fa-cog"></i> Config</label>
<input type="text" id="node-input-config">
</div>
</script>
<script type="text/html" data-help-name="collabora-transform">
<p><strong>Write values into a document.</strong> Takes document + JSON fields/transform and asks CODE to fill them in. Result is a new document binary, not JSON.</p>
<h4>Input</h4>
<ul>
<li>Document: <code>msg.payload</code> or <code>msg.ncPath</code> (WebDAV)</li>
<li>Instruction: <code>msg.transform</code> or <code>msg.fields</code> — required</li>
</ul>
<h4>Output</h4>
<p>POST multipart to <code>/cool/transform-document-structure</code>. Fields: <code>data</code> = file, <code>transform</code> = JSON.</p>
<p><code>msg.payload</code> = modified file (Buffer), plus <code>contentType</code></p>
<h4>When to use</h4>
<p>Fill a template via CODE directly, not Nextcloud's template API. Save yourself afterwards (WebDAV PUT / bridge / nc-office) if the file should live in the cloud.</p>
<pre>msg.ncPath = "/Templates/contract.docx"
msg.fields = { "Customer": "ACME Ltd", "Date": "2026-08-22" }
→ collabora-transform
→ (save or convert to PDF)</pre>
</script>