Skip to content

Commit

Permalink
deploy: 3105ff3
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Dec 4, 2024
1 parent 16fc134 commit e7ee9e5
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/mockup/bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mockup/bundle.min.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mockup/remote.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mockup/remote.min.js.map

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions pat/contenbrowser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@ <h2>Configuration</h2>
<td style="text-align:center">20</td>
<td style="text-align:center">Maximum items to keep in recently used list. 0: no restriction.</td>
</tr>
<tr>
<td style="text-align:center">customComponentKeys</td>
<td style="text-align:center">dict</td>
<td style="text-align:center">{}</td>
<td style="text-align:center">Register custom components. Currently only &quot;SelectedItem&quot; implemented</td>
</tr>
</tbody>
</table>
<h2>Default</h2>
Expand All @@ -465,6 +471,12 @@ <h2>Select a single item</h2>
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span><br> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>text<span class="token punctuation">"</span></span><br> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>pat-contentbrowser<span class="token punctuation">"</span></span><br> <span class="token attr-name">data-pat-contentbrowser</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">'</span>{"selectableTypes": ["Document"], "vocabularyUrl": "contentbrowser-test.json", "maximumSelectionSize": 1}<span class="token punctuation">'</span></span><br><span class="token punctuation">/></span></span></code></pre>
<h2>Mode &quot;browse&quot;, Upload</h2>
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span><br> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>text<span class="token punctuation">"</span></span><br> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>pat-contentbrowser<span class="token punctuation">"</span></span><br> <span class="token attr-name">data-pat-contentbrowser</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">'</span>{"selectableTypes": ["Image", "File"], "vocabularyUrl": "contentbrowser-test.json", "upload": true}<span class="token punctuation">'</span></span><br><span class="token punctuation">/></span></span></code></pre>
<h2>Register custom component</h2>
<p>Currently only for <code>SelectedItem</code> component available.</p>
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>input</span><br> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>text<span class="token punctuation">"</span></span><br> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>pat-contentbrowser<span class="token punctuation">"</span></span><br> <span class="token attr-name">data-pat-contentbrowser</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">'</span>{<br> "customComponentKeys": {<br> "SelectedItem": "pat-contentbrowser.myfield.MySelectedItemComponent",<br> },<br> }<span class="token punctuation">'</span></span><br><span class="token punctuation">/></span></span></code></pre>
<p>Copy the existing component <code>src/SelectedItem.svelte</code> to your addon, customize it and register it in your JS bundle as follows:</p>
<pre class="language-javascript"><code class="language-javascript"><span class="token operator">...</span><br><span class="token keyword">import</span> plone_registry <span class="token keyword">from</span> <span class="token string">"@plone/registry"</span><span class="token punctuation">;</span><br><span class="token operator">...</span><br><br><span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">register_selecteditem_component</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><br> <span class="token comment">// we register our component to a custom keyname,</span><br> <span class="token comment">// which later can be used for pattern_options</span><br> <span class="token keyword">const</span> SelectedImages <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">await</span> <span class="token keyword">import</span><span class="token punctuation">(</span><span class="token string">"./MySelectedItemComponent.svelte"</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span>default<span class="token punctuation">;</span><br> plone_registry<span class="token punctuation">.</span><span class="token function">registerComponent</span><span class="token punctuation">(</span><span class="token punctuation">{</span><br> <span class="token literal-property property">name</span><span class="token operator">:</span> <span class="token string">"pat-contentbrowser.myfield.MySelectedItemComponent"</span><span class="token punctuation">,</span><br> <span class="token literal-property property">component</span><span class="token operator">:</span> SelectedImages<span class="token punctuation">,</span><br> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span><br><span class="token punctuation">}</span><br><span class="token function">register_selecteditem_component</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><br><br><span class="token operator">...</span><br></code></pre>
<p>Note: this needs the <code>svelte-loader</code> plugin in your webpack.config.js ... see mockups webpack config for info.</p>

</main>
</div>
Expand Down

0 comments on commit e7ee9e5

Please sign in to comment.