@pageboard/html 0.11.23 → 0.11.24

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.
@@ -0,0 +1,88 @@
1
+ exports.heading = {
2
+ title: "Heading",
3
+ priority: 10,
4
+ properties: {
5
+ level: {
6
+ title: 'Level',
7
+ description: 'Between 1 and 6',
8
+ type: "integer",
9
+ default: 1,
10
+ minimum: 1,
11
+ maximum: 6
12
+ },
13
+ align: {
14
+ title: 'Align',
15
+ default: "left",
16
+ anyOf: [{
17
+ const: "left",
18
+ title: "Left",
19
+ icon: '<i class="icon align left"></i>'
20
+ }, {
21
+ const: "center",
22
+ title: "Center",
23
+ icon: '<i class="icon align center"></i>'
24
+ }, {
25
+ const: "right",
26
+ title: "Right",
27
+ icon: '<i class="icon align right"></i>'
28
+ }, {
29
+ const: "justify",
30
+ title: "Justify",
31
+ icon: '<i class="icon align justify"></i>'
32
+ }]
33
+ },
34
+ linkable: {
35
+ title: 'Show hash link',
36
+ description: 'On hover',
37
+ type: 'boolean',
38
+ default: false
39
+ },
40
+ id: {
41
+ nullable: true,
42
+ type: 'string',
43
+ pattern: /^[a-z0-9-]*$/.source
44
+ },
45
+ entitled: {
46
+ title: 'H1 is a page title',
47
+ type: 'boolean',
48
+ nullable: true
49
+ }
50
+ },
51
+ contents: {
52
+ id: 'text',
53
+ nodes: "inline*"
54
+ },
55
+ group: "block",
56
+ icon: '<i class="icon header"></i>',
57
+ tag: 'h1,h2,h3,h4,h5,h6',
58
+ html: `<h[level] class="ui [align|or:left] aligned header" is="h[level]-helper" id="[id]" entitled="[entitled]">
59
+ <a aria-hidden="true" href="[$loc.pathname][$loc.search][id|pre:#]">[linkable|bmagnet]#</a>
60
+ <div block-content="text">Heading</div>
61
+ </hn>`,
62
+ parse: function (dom) {
63
+ return {
64
+ level: parseInt(dom.nodeName.substring(1))
65
+ };
66
+ },
67
+ stylesheets: [
68
+ '../ui/heading.css'
69
+ ],
70
+ scripts: [
71
+ '../ui/heading.js'
72
+ ],
73
+ resources: {
74
+ helper: '../ui/heading-helper.js'
75
+ },
76
+ install: function (scope) {
77
+ if (scope.$write) Pageboard.load.js(this.resources.helper, scope);
78
+ }
79
+ };
80
+
81
+
82
+ exports.heading_nolink = {
83
+ ...exports.heading,
84
+ priority: exports.heading.priority - 1,
85
+ group: null,
86
+ contents: { ...exports.heading.contents, marks: "nolink" }
87
+ };
88
+
@@ -87,85 +87,6 @@ exports.segment = {
87
87
  ]
88
88
  };
89
89
 
90
- exports.heading = {
91
- title: "Heading",
92
- properties: {
93
- level: {
94
- title: 'Level',
95
- description: 'Between 1 and 6',
96
- type: "integer",
97
- default: 1,
98
- minimum: 1,
99
- maximum: 6
100
- },
101
- align: {
102
- title: 'Align',
103
- default: "left",
104
- anyOf: [{
105
- const: "left",
106
- title: "Left",
107
- icon: '<i class="icon align left"></i>'
108
- }, {
109
- const: "center",
110
- title: "Center",
111
- icon: '<i class="icon align center"></i>'
112
- }, {
113
- const: "right",
114
- title: "Right",
115
- icon: '<i class="icon align right"></i>'
116
- }, {
117
- const: "justify",
118
- title: "Justify",
119
- icon: '<i class="icon align justify"></i>'
120
- }]
121
- },
122
- linkable: {
123
- title: 'Show hash link',
124
- description: 'On hover',
125
- type: 'boolean',
126
- default: false
127
- },
128
- id: {
129
- nullable: true,
130
- type: 'string',
131
- pattern: /^[a-z0-9-]*$/.source
132
- }
133
- },
134
- contents: {
135
- id: 'text',
136
- nodes: "inline*"
137
- },
138
- group: "block",
139
- icon: '<i class="icon header"></i>',
140
- tag: 'h1,h2,h3,h4,h5,h6',
141
- html: `<h[level] class="ui [align|or:left] aligned header" is="h[level]-helper" id="[id]">
142
- <a aria-hidden="true" href="[$loc.pathname][$loc.search][id|pre:#]">[linkable|bmagnet]#</a>
143
- <div block-content="text">Heading</div>
144
- </hn>`,
145
- parse: function(dom) {
146
- return {
147
- level: parseInt(dom.nodeName.substring(1))
148
- };
149
- },
150
- stylesheets: [
151
- '../ui/heading.css'
152
- ],
153
- resources: {
154
- helper: '../ui/heading-helper.js'
155
- },
156
- install: function(scope) {
157
- if (scope.$write) Pageboard.load.js(this.resources.helper, scope);
158
- }
159
- };
160
-
161
-
162
- exports.heading_nolink = {
163
- ...exports.heading,
164
- priority: exports.heading.priority - 1,
165
- group: null,
166
- contents: { ...exports.heading.contents, marks: "nolink" }
167
- };
168
-
169
90
  exports.divider = {
170
91
  title: "Divider",
171
92
  group: "block",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.11.23",
3
+ "version": "0.11.24",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/heading.js ADDED
@@ -0,0 +1,8 @@
1
+ Page.patch(state => {
2
+ state.finish(() => {
3
+ const entitled = document.querySelector('h1[entitled]');
4
+ if (entitled) {
5
+ document.title = entitled.textContent + ' - ' + document.title;
6
+ }
7
+ });
8
+ });