@teipublisher/pb-components 1.28.1 → 1.30.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,36 @@
1
+ ## [1.30.1](https://github.com/eeditiones/tei-publisher-components/compare/v1.30.0...v1.30.1) (2021-12-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **odd editor:** add translations for pb:set-param and [@pb](https://github.com/pb):mode ([1e5422f](https://github.com/eeditiones/tei-publisher-components/commit/1e5422f53d0bbfff12b18f2d66805844b6449ef7))
7
+
8
+ # [1.30.0](https://github.com/eeditiones/tei-publisher-components/compare/v1.29.0...v1.30.0) (2021-12-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **pb-view-annotate:** fix range detection bugs ([d1f31b3](https://github.com/eeditiones/tei-publisher-components/commit/d1f31b3687f58d924f76d32e68bd53f0e53d79d2))
14
+
15
+
16
+ ### Features
17
+
18
+ * **pb-view-annotate:** emit pb-annotation-colors event if annotation color scheme changed ([185b075](https://github.com/eeditiones/tei-publisher-components/commit/185b075fa72191d7fb8753026a38e217b90fd8d9))
19
+
20
+ # [1.29.0](https://github.com/eeditiones/tei-publisher-components/compare/v1.28.2...v1.29.0) (2021-11-26)
21
+
22
+
23
+ ### Features
24
+
25
+ * **pb-view:** allow custom javascript to intercept updates and modify content before it is shown ([c98035e](https://github.com/eeditiones/tei-publisher-components/commit/c98035e8696cb4e642c6a8396b346ceb29e83595))
26
+
27
+ ## [1.28.2](https://github.com/eeditiones/tei-publisher-components/compare/v1.28.1...v1.28.2) (2021-11-23)
28
+
29
+
30
+ ### Bug Fixes
31
+
32
+ * **pb-table-grid:** start item reported to server should be 1, not 0 ([8feab1d](https://github.com/eeditiones/tei-publisher-components/commit/8feab1db0b8d0bd8e8db5b8ecbaf531485a3c94b))
33
+
1
34
  ## [1.28.1](https://github.com/eeditiones/tei-publisher-components/compare/v1.28.0...v1.28.1) (2021-11-23)
2
35
 
3
36
 
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "pb-view": {
3
3
  "demo/pb-view.html": "View TEI document",
4
- "demo/pb-view2.html": "Docbook document"
4
+ "demo/pb-view2.html": "Docbook document",
5
+ "demo/pb-view3.html": "Manipulating content via JS"
5
6
  },
6
7
  "pb-document": {
7
8
  "demo/pb-document.html": "Demo"
@@ -0,0 +1,90 @@
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8"/>
4
+ <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes"/>
5
+
6
+ <title>pb-view Demo</title>
7
+ <script src="https://unpkg.com/@webcomponents/webcomponentsjs@2.4.3/webcomponents-loader.js"></script><script type="module" src="../pb-components-bundle.js"></script>
8
+ </head>
9
+
10
+ <body>
11
+ <pb-demo-snippet>
12
+ <template>
13
+ <style type="text/css">
14
+ pb-page {
15
+ position: relative;
16
+ }
17
+
18
+ #view1 {
19
+ height: 70vh;
20
+ overflow: auto;
21
+ display: flex;
22
+ justify-content: center;
23
+ margin-left: auto;
24
+ margin-right: auto;
25
+ }
26
+
27
+ @media (min-width: 769px) {
28
+ #view1, footer {
29
+ max-width: 60vw;
30
+ }
31
+ }
32
+
33
+ footer {
34
+ position: relative;
35
+ margin-top: 10px;
36
+ bottom: 0;
37
+ background-color: #f2f2f2;
38
+ margin-left: auto;
39
+ margin-right: auto;
40
+ }
41
+
42
+ pb-navigation[disabled] {
43
+ display: block;
44
+ visibility: hidden;
45
+ }
46
+
47
+ pb-navigation[direction="forward"] {
48
+ float: right;
49
+ }
50
+ </style>
51
+ <p>Demonstrates how to manipulate pb-view contents via Javascript before they are displayed in a pb-view:</p>
52
+ <pb-page endpoint="https://teipublisher.com/exist/apps/tei-publisher">
53
+ <pb-document id="document1" path="test/graves6.xml"></pb-document>
54
+
55
+ <pb-progress subscribe="transcription"></pb-progress>
56
+ <!-- Output the document title -->
57
+ <pb-view src="document1" xpath="//teiHeader/fileDesc/titleStmt/title"
58
+ subscribe="transcription">
59
+ <pb-param name="header" value="short"/>
60
+ </pb-view>
61
+ <pb-view id="view1" src="document1" view="single" append-footnotes animation
62
+ before-update-event="before-transcription-update"
63
+ subscribe="transcription" emit="transcription"></pb-view>
64
+ </pb-page>
65
+ <script>
66
+ window.addEventListener('DOMContentLoaded', () => {
67
+ pbEvents.subscribe('before-transcription-update', 'transcription', (ev) => {
68
+ const root = ev.detail.root;
69
+ // walk through all .tei-name elements and insert a node before each
70
+ root.querySelectorAll('.tei-name').forEach((name) => {
71
+ // create a span with text 'Name' and orange color
72
+ const span = document.createElement('span');
73
+ span.innerHTML = 'Name';
74
+ span.style.backgroundColor = 'orange';
75
+ span.style.padding = '0 4px';
76
+ span.style.fontSize = '.85em';
77
+ // insert the span before the name
78
+ name.parentNode.insertBefore(span, name);
79
+ });
80
+
81
+ // to actually show the modified content in the pb-view,
82
+ // we need to call the render function passed in the event detail:
83
+ ev.detail.render(root);
84
+ });
85
+ });
86
+ </script>
87
+ </template>
88
+ </pb-demo-snippet>
89
+ </body>
90
+ </html>