hdoc-tools 0.15.2 → 0.15.3

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.
package/hdoc-serve.js CHANGED
@@ -223,10 +223,11 @@
223
223
 
224
224
  // Process redirect
225
225
  if (hdocbook_project.redirects && hdocbook_project.redirects instanceof Array && hdocbook_project.redirects.length > 0) {
226
- const source_url = url.indexOf('/') === 0 ? url.replace('/', '') : url;
226
+ const source_url = url.indexOf('/') === 0 ? url : `/${url}`;
227
227
  hdocbook_project.redirects.forEach(function (redir) {
228
+ redir.url = redir.url.indexOf('/') === 0 ? redir.url : `/${redir.url}`
228
229
  if (redir.url === source_url && redir.location && redir.location !== '') {
229
- url = `/${redir.location}`;
230
+ url = `${redir.location}`;
230
231
  console.log(`Redirecting to ${url}`);
231
232
  }
232
233
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {
package/ui/index.html CHANGED
@@ -203,8 +203,7 @@
203
203
 
204
204
  <nav class="hdoc-nav hb-container-expand" id="DocSidebarNav" aria-labelledby="sidebar-aria-label"
205
205
  tabindex="-1">
206
- <div v-for="(navSection,index) in docApp.navSections"
207
- v-bind:class="{'group':navSection.items, 'nogrouplink':!navSection.items}">
206
+ <div v-for="(navSection,index) in docApp.navSections" v-bind:class="{'group':navSection.items, 'nogrouplink':!navSection.items}">
208
207
 
209
208
  <div v-show="!navSection.items">
210
209
  <a class="DocLink link noitems" v-bind:href="navSection.link"
@@ -219,6 +218,17 @@
219
218
  v-bind:asection="navSection"></nav-section-component>
220
219
  </div>
221
220
  </div>
221
+
222
+ <div v-if="docApp.hasInlinePopupDocuments" class="nogrouplink">
223
+ <div>
224
+ <a class="DocLink link noitems" v-on:click="showInlineDocumentList($event)">
225
+ <span class="link-text">
226
+ Inline Help Documents
227
+ </span>
228
+ </a>
229
+ </div>
230
+ </div>
231
+
222
232
  </nav>
223
233
 
224
234
  </aside>
@@ -226,7 +236,8 @@
226
236
  <!-- the right hand content col -->
227
237
  <div class="DocContent hb-container-expand hb-container-vertical" id="DocContent">
228
238
  <div class="HTL-doc content-wrapper hb-container-expand">
229
- <div class="injected-document-container hb-container-horizontal">
239
+
240
+ <div v-show="!docApp.showInlineDocumentsMarkup" class="injected-document-container hb-container-horizontal">
230
241
 
231
242
  <div class="injected-document-content">
232
243
  <div class="document-header">
@@ -286,9 +297,6 @@
286
297
  </div>
287
298
 
288
299
 
289
-
290
-
291
-
292
300
  <!-- table of contents -->
293
301
  <div v-if="docApp.keepTocLayout" class="injected-document-toc">
294
302
  <div v-if="docApp.tableOfContents.length" class="panel-header">
@@ -307,6 +315,38 @@
307
315
 
308
316
  </div>
309
317
 
318
+ <!-- show inline document links -->
319
+ <div v-if="docApp.showInlineDocumentsMarkup" class="hb-container-vertical">
320
+
321
+ <!-- the problem is the test server doesn't serve inline documents like the live/proper one ?? -->
322
+ <div class="modal fade" id="inlineModal" tabindex="-1" role="dialog" aria-hidden="true">
323
+ <div class="modal-dialog" role="document">
324
+ <div class="modal-content">
325
+ <iframe v-if="docApp.inlinePopupDocumentHref" v-bind:src="docApp.inlinePopupDocumentHref"></iframe>
326
+ </div>
327
+ </div>
328
+ </div>
329
+
330
+
331
+ <div class="p-4">
332
+
333
+ <div class="document-header">
334
+ <div class="document-title"><h1>Inline Help Documents (DOES NOT WORK) - NOTE DEV SERVER NEEDS _inline.html PROCESSING - NEED TO SPEAK TO GERRY</h1></div>
335
+ </div>
336
+
337
+ <div class="p-2">
338
+ <div v-for="(navSectionItem,index) in docApp.inlineDocumentItems">
339
+
340
+ <a class="DocLink link noitems" href="#" v-on:click="popupInlineDocument($event,navSectionItem)" style="padding-left: 0px;">
341
+ <span class="link-text"><i v-if="navSectionItem.draft" class="bi bi-exclamation-triangle-fill text-danger" title="This page is set to draft."></i><i class="bi bi-files-alt text-warning"></i> {{navSectionItem.text}}</span>
342
+ </a>
343
+
344
+ </div>
345
+ </div>
346
+ </div>
347
+ </div>
348
+
349
+
310
350
  </div>
311
351
  </div>
312
352
 
@@ -314,6 +354,8 @@
314
354
 
315
355
  </div> <!-- <div class="main hb-vertical-expand"> -->
316
356
 
357
+
358
+
317
359
  </body>
318
360
  <script>
319
361
 
@@ -12,6 +12,31 @@ var docAppMethods = {
12
12
  let self = this;
13
13
  self.docApp.userSession = info;
14
14
  },
15
+
16
+ showInlineDocumentList:function(ev)
17
+ {
18
+ if(ev)
19
+ {
20
+ ev.stopImmediatePropagation();
21
+ ev.preventDefault();
22
+ }
23
+
24
+ let self = this;
25
+ self.docApp.showInlineDocumentsMarkup = true;
26
+ self.$forceUpdate();
27
+ },
28
+ popupInlineDocument:function(ev,navSectionItem)
29
+ {
30
+ if(ev)
31
+ {
32
+ ev.stopImmediatePropagation();
33
+ ev.preventDefault();
34
+ }
35
+
36
+ $('#inlineModal').modal("show");
37
+ let self = this;
38
+ self.docApp.inlinePopupDocumentHref = navSectionItem.link;
39
+ },
15
40
  switchViewTheme: function () {
16
41
  if (ThemePreference) document.documentElement.classList.remove(ThemePreference);
17
42
 
@@ -456,33 +481,56 @@ function old_expandNavParentSectionBySelectedLinkHref(findByLinkRef, currentNavS
456
481
 
457
482
  }
458
483
 
459
- function setBrowserViewUrl(strHrefToLoad, viewData, fromPageRefresh, fromPopState) {
460
-
461
- let urlToSet = window.location.origin + "/" + strHrefToLoad;
462
- const url = new URL(urlToSet);
463
-
464
- //-- remove any old params
465
- for (let strKey in global.stateParams) {
466
- url.searchParams.delete(strKey);
467
- }
468
-
469
- //-- now set new data params in url
470
- for (let strKey in viewData) {
471
- url.searchParams.set(strKey, viewData[strKey]);
484
+ var lastUrlDynamicallySet = "";
485
+ function setBrowserViewUrl(strHrefToLoad,viewData,fromPageRefresh,fromPopState)
486
+ {
487
+
488
+ let urlToSet = window.location.origin + "/" + strHrefToLoad;
489
+ const url = new URL(urlToSet);
490
+
491
+ //-- remove any old params
492
+ for(let strKey in global.stateParams)
493
+ {
494
+ url.searchParams.delete(strKey);
495
+ }
496
+
497
+ //-- now set new data params in url
498
+ for(let strKey in viewData)
499
+ {
500
+ url.searchParams.set(strKey,viewData[strKey]);
501
+ }
502
+
503
+ //-- store global params
504
+ global.stateParams = viewData;
505
+
506
+ if(!fromPageRefresh)
507
+ {
508
+ if(fromPopState)
509
+ {
510
+ //-- so user has clicked on a link - always add entry
511
+ window.history.pushState(null, null, url); //-- add entry
472
512
  }
473
-
474
- //-- store global params
475
- global.stateParams = viewData;
476
-
477
- if (!fromPopState) {
478
- if (fromPageRefresh) {
479
- window.history.replaceState(null, null, url); //-- user has refreshed page or jsut visited page
480
- }
481
- else {
482
- window.history.pushState(null, null, url); //-- user has clicked a link so we want to add state to history so we can click back
513
+ else
514
+ {
515
+ if(lastUrlDynamicallySet)
516
+ {
517
+ if(lastUrlDynamicallySet!==strHrefToLoad)
518
+ {
519
+ window.history.pushState(null, null, url); //-- add entry
520
+ }
521
+ else
522
+ {
523
+ window.history.replaceState(null, null, url); //-- user has refreshed page or jsut visited page
524
+
525
+ }
526
+ }
527
+ else
528
+ {
529
+ window.history.replaceState(null, null, url); //-- user has clicked a link so we want to add state to history so we can click back
530
+ }
483
531
  }
484
532
  }
485
-
533
+ lastUrlDynamicallySet=strHrefToLoad;
486
534
  }
487
535
 
488
536
  async function fetchContentFile(strFilePath) {
@@ -503,7 +551,7 @@ $(".document-body").attr("v-pre", "");
503
551
 
504
552
  var view = new Vue({
505
553
  el: '#vDocDevApp',
506
- data: { userSession: {}, updateCounter: 0, bookId: "", docApp: { keepTocLayout: false, book: {}, navSections: [], tableOfContents: [], bookBreadCrumb: [] } },
554
+ data: { userSession: {}, updateCounter: 0, bookId: "", docApp: {inlinePopupDocumentHref:"",showInlineDocumentsMarkup:false, keepTocLayout: false, book: {}, navSections: [], inlineDocumentItems:[], tableOfContents: [], bookBreadCrumb: [] } },
507
555
  methods: docAppMethods,
508
556
  directives: {
509
557
  somedirectivename: {
@@ -582,7 +630,6 @@ async function intialiseApp() {
582
630
  });
583
631
 
584
632
  //-- eof session stuff
585
-
586
633
  await fetchJsonFile("_books/library.json").then(function (data) {
587
634
 
588
635
  // Get docbook library list
@@ -592,14 +639,22 @@ async function intialiseApp() {
592
639
  }).then(function () {
593
640
  // Get hdocbook.json
594
641
  fetchJsonFile("_books/" + view.docId + "/hdocbook.json").then(function (data) {
595
- console.log(view.docApp.library.books[0].nav_inline)
642
+ //console.log(view.docApp.library.books[0].nav_inline)
596
643
  view.docApp.book = data;
597
644
  view.bookId = data.docId;
598
645
  view.docApp.title = data.title || "";
599
646
  view.docApp.description = data.description || "";
600
647
 
601
- if (view.docApp.library.books[0].nav_inline.text)
648
+
649
+ view.docApp.inlineDocumentItems = [];
650
+ view.docApp.inlinePopupDocumentHref = "";
651
+ view.docApp.showInlineDocumentsMarkup = false;
652
+ view.docApp.hasInlinePopupDocuments = (view.docApp.library.books[0].nav_inline && view.docApp.library.books[0].nav_inline.items && view.docApp.library.books[0].nav_inline.items.length)?true:false
653
+ if(view.docApp.hasInlinePopupDocuments)
654
+ {
655
+ view.docApp.inlineDocumentItems = view.docApp.library.books[0].nav_inline.items;
602
656
  view.docApp.book.navigation.items.push(view.docApp.library.books[0].nav_inline);
657
+ }
603
658
 
604
659
  //-- now render out the nav menu
605
660
  view.renderNavigation();