Skip to content

Commit 461e988

Browse files
line-oDrRataplan
authored andcommitted
feat(editor): allow setting of schema attribute
refs #60 adding ```json { "features": { "schema": "url/to/myschema.json" } } ``` will add the schema attribute to the jinn-tap element and load it.
1 parent 79d6b10 commit 461e988

File tree

1 file changed

+43
-16
lines changed

1 file changed

+43
-16
lines changed

profiles/jinntap/templates/editor.html

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
},
1111
"register": {
1212
"enabled": false
13-
},
14-
"metadata-editor": {
15-
"enabled": true
16-
}
13+
},
14+
"metadata-editor": {
15+
"enabled": true
16+
}
1717
},
1818
"templating": {
1919
"extends": "templates/layouts/base.html",
@@ -141,22 +141,36 @@
141141
</li>
142142
</ul>
143143

144-
<ul>
145-
[% block toolbar %][% endblock %]
146-
</ul>
144+
<ul>
145+
[% block toolbar %][% endblock %]
146+
</ul>
147147
</nav>
148148
[% endtemplate %]
149149

150-
[% template after %]
151-
<div id="attributes-panel"></div>
152-
[% endtemplate %]
150+
[% template after %]
151+
<div id="attributes-panel"></div>
152+
[% endtemplate %]
153153

154154
<main>
155155
[% let $url = if (map:contains($context, 'doc')) then $context-path || "/api/document/" || $context?doc?path else () %]
156-
[% if $features?collab?enable %]
156+
[% if ($features?collab?enable and $features?schema) %]
157+
<jinn-tap url="[[ $url ]]" name="[[ $context?doc?path ]]" schema="[[ $context?features?schema ]]"
158+
token="[[ jt:jwt-token() ]]" server="[[ $features?collab?server ]]" sidebar="#attributes-panel">
159+
<img slot="aside" class="logo" src="https://cdn.jsdelivr.net/npm/@jinntec/jinntap@latest/dist/jinntap-logo-128.png" alt="JinnTap"/>
160+
<li slot="toolbar">
161+
<a href="#" id="saveBtn" class="toolbar-button" data-tooltip="Save" data-placement="bottom">
162+
<i class="bi bi-floppy"></i>
163+
</a>
164+
</li>
165+
<li slot="toolbar">
166+
<a href="#" class="toolbar-button" id="copyBtn" data-tooltip="Copy TEI to clipboard" data-placement="bottom">
167+
<i class="bi bi-clipboard-plus"></i>
168+
</a>
169+
</li>
170+
</jinn-tap>
171+
[% elif $features?collab?enable %]
157172
<jinn-tap url="[[ $url ]]" name="[[ $context?doc?path ]]"
158-
token="[[ jt:jwt-token() ]]" server="[[ $features?collab?server ]]"
159-
sidebar="#attributes-panel">
173+
token="[[ jt:jwt-token() ]]" server="[[ $features?collab?server ]]" sidebar="#attributes-panel">
160174
<img slot="aside" class="logo" src="https://cdn.jsdelivr.net/npm/@jinntec/jinntap@latest/dist/jinntap-logo-128.png" alt="JinnTap"/>
161175
<li slot="toolbar">
162176
<a href="#" id="saveBtn" class="toolbar-button" data-tooltip="Save" data-placement="bottom">
@@ -168,11 +182,24 @@
168182
<i class="bi bi-clipboard-plus"></i>
169183
</a>
170184
</li>
171-
</jinn-tap>
185+
</jinn-tap>
186+
[% elif $features?schema %]
187+
<jinn-tap url="[[ $url ]]" name="[[ $context?doc?path ]]" notes="disconnected" schema="[[ $context?features?schema ]]" sidebar="#attributes-panel">
188+
<img slot="aside" class="logo" src="https://cdn.jsdelivr.net/npm/@jinntec/jinntap@latest/dist/jinntap-logo-128.png" alt="JinnTap"/>
189+
<li slot="toolbar">
190+
<a href="#" id="saveBtn" class="toolbar-button" data-tooltip="Save" data-placement="bottom">
191+
<i class="bi bi-floppy"></i>
192+
</a>
193+
</li>
194+
<li slot="toolbar">
195+
<a href="#" class="toolbar-button" id="copyBtn" data-tooltip="Copy TEI to clipboard" data-placement="bottom">
196+
<i class="bi bi-clipboard-plus"></i>
197+
</a>
198+
</li>
199+
</jinn-tap>
172200
[% else %]
173201
<jinn-tap url="[[ $url ]]" name="[[ $context?doc?path ]]" notes="disconnected" sidebar="#attributes-panel">
174-
<img slot="aside" class="logo" src="https://cdn.jsdelivr.net/npm/@jinntec/jinntap@latest/dist/jinntap-logo-128.png"
175-
alt="JinnTap" />
202+
<img slot="aside" class="logo" src="https://cdn.jsdelivr.net/npm/@jinntec/jinntap@latest/dist/jinntap-logo-128.png" alt="JinnTap"/>
176203
<li slot="toolbar">
177204
<a href="#" id="saveBtn" class="toolbar-button" data-tooltip="Save" data-placement="bottom">
178205
<i class="bi bi-floppy"></i>

0 commit comments

Comments
 (0)