@teipublisher/pb-components 1.41.0 → 1.41.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -403,6 +403,26 @@ export class PbOddModelEditor extends LitElement {
403
403
  }
404
404
 
405
405
  render() {
406
+ let tmplSyntax;
407
+ switch (this.output) {
408
+ case 'web':
409
+ case 'epub':
410
+ tmplSyntax = 'html';
411
+ break;
412
+ case 'latex':
413
+ tmplSyntax = 'tex';
414
+ break;
415
+ case 'plain':
416
+ tmplSyntax = 'default';
417
+ break;
418
+ case 'fo':
419
+ case 'print':
420
+ tmplSyntax = 'xml';
421
+ break;
422
+ default:
423
+ tmplSyntax = 'html';
424
+ break;
425
+ }
406
426
  return html`
407
427
  <form>
408
428
  <header>
@@ -511,9 +531,24 @@ export class PbOddModelEditor extends LitElement {
511
531
  <label>Template</label>
512
532
  <jinn-codemirror id="template"
513
533
  code="${this.template}"
514
- mode="${this.output === 'latex' ? 'tex' : 'xml'}"
534
+ mode="${tmplSyntax}"
515
535
  placeholder="${translate('odd.editor.model.template-placeholder')}"
516
536
  @update="${this._updateTemplate}">
537
+ <div slot="toolbar">
538
+ <paper-button data-mode="xml" data-command="selectElement" data-key="mod-e mod-s"
539
+ title="Select element around current cursor position">&lt;|></paper-button>
540
+ <paper-button data-mode="xml" data-command="encloseWith" data-key="mod-e mod-e"
541
+ title="Enclose selection in new element">&lt;...&gt;</paper-button>
542
+ <paper-button data-mode="xml" data-command="removeEnclosing" title="Remove enclosing tags"
543
+ data-key="mod-e mod-r" class="sep">&lt;X></paper-button>
544
+ <paper-button data-mode="html" data-command="selectElement" data-key="mod-e mod-s"
545
+ title="Select element around current cursor position">&lt;|></paper-button>
546
+ <paper-button data-mode="html" data-command="encloseWith" data-key="mod-e mod-e"
547
+ title="Enclose selection in new element">&lt;...&gt;</paper-button>
548
+ <paper-button data-mode="html" data-command="removeEnclosing" title="Remove enclosing tags"
549
+ data-key="mod-e mod-r" class="sep">&lt;X></paper-button>
550
+ <paper-button data-key="mod-e mod-p" data-command="snippet" data-params="[[\${_}]]" title="Insert template variable">[[...]]</paper-button>
551
+ </div>
517
552
  </jinn-codemirror>
518
553
  </div>
519
554
  </div>
@@ -874,7 +909,7 @@ export class PbOddModelEditor extends LitElement {
874
909
  }
875
910
 
876
911
  _updateTemplate(ev) {
877
- this.template = this.shadowRoot.getElementById('template').value;
912
+ this.template = this.shadowRoot.getElementById('template').content;
878
913
  this._fireModelChanged('template', this.template);
879
914
  }
880
915
 
@@ -65,7 +65,7 @@ export class PbOddRenditionEditor extends LitElement {
65
65
  <jinn-codemirror
66
66
  id="editor"
67
67
  label="Rendition"
68
- code="${this.css}"
68
+ code="${this.css || ''}"
69
69
  mode="css"
70
70
  @update="${this._handleCodeChange}"></jinn-codemirror>
71
71
  </div>