Skip to content

Commit

Permalink
fix(Web): Update Microdata URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome authored and alex-ketch committed Feb 18, 2022
1 parent 294f511 commit 89f261a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion web/src/editors/article/components/codeBlock/codeBlock.ts
Expand Up @@ -43,7 +43,7 @@ export function codeBlock(): NodeSpec {
},
parseDOM: [
{
tag: '[itemtype="http://schema.stenci.la/CodeBlock"]',
tag: '[itemtype="https://schema.stenci.la/CodeBlock"]',
preserveWhitespace: 'full',
contentElement: 'code',
getAttrs(dom) {
Expand Down
Expand Up @@ -37,7 +37,7 @@ export class CodeBlockView implements NodeView {
this.incomingChanges = false

this.dom = document.createElement('stencila-code-block')
this.dom.setAttribute('itemtype', 'http://schema.stenci.la/CodeBlock')
this.dom.setAttribute('itemtype', 'https://schema.stenci.la/CodeBlock')

if (typeof node.attrs.id === 'string' && node.attrs.id !== '') {
this.dom.setAttribute('id', node.attrs.id)
Expand Down
2 changes: 1 addition & 1 deletion web/src/editors/article/components/codeChunk/codeChunk.ts
Expand Up @@ -43,7 +43,7 @@ export function codeChunk(): NodeSpec {
},
parseDOM: [
{
tag: '[itemtype="http://schema.stenci.la/CodeChunk"]',
tag: '[itemtype="https://schema.stenci.la/CodeChunk"]',
preserveWhitespace: 'full',
contentElement: 'code',
getAttrs(dom) {
Expand Down
Expand Up @@ -37,7 +37,7 @@ export class CodeChunkView implements NodeView {
this.incomingChanges = false

this.dom = document.createElement('stencila-code-chunk')
this.dom.setAttribute('itemtype', 'http://schema.stenci.la/CodeChunk')
this.dom.setAttribute('itemtype', 'https://schema.stenci.la/CodeChunk')

if (typeof node.attrs.id === 'string' && node.attrs.id !== '') {
this.dom.setAttribute('id', node.attrs.id)
Expand Down
4 changes: 2 additions & 2 deletions web/src/editors/article/index.ts
Expand Up @@ -79,7 +79,7 @@ export class ArticleEditor {
constructor() {
// Get the source <article> element and hide it
const sourceElem = document.querySelector<HTMLElement>(
'[itemtype="http://schema.org/Article"]'
'[itemtype="https://schema.org/Article"]'
)
if (sourceElem === null) {
console.warn('Did not find an article on the page')
Expand Down Expand Up @@ -121,7 +121,7 @@ export class ArticleEditor {
// Create the editor <article> element
const editorElem = document.createElement('article')
editorElem.setAttribute('data-root', '')
editorElem.setAttribute('itemtype', 'http://schema.org/Article')
editorElem.setAttribute('itemtype', 'https://schema.org/Article')
editorElem.setAttribute('itemscope', '')
sourceElem.parentElement?.appendChild(editorElem)
// Remove the original elements to avoid duplicate element IDs on the page
Expand Down
20 changes: 10 additions & 10 deletions web/src/editors/article/schema.ts
Expand Up @@ -143,7 +143,7 @@ function block(
toDOM(_node) {
return [
tag,
{ itemtype: `http://schema.stenci.la/${name}`, itemscope: '' },
{ itemtype: `https://schema.stenci.la/${name}`, itemscope: '' },
0,
]
},
Expand Down Expand Up @@ -175,7 +175,7 @@ function heading(): NodeSpec {
toDOM(node) {
return [
`h${(node.attrs.depth as number) + 1}`,
{ itemtype: 'http://schema.stenci.la/Heading', itemscope: '' },
{ itemtype: 'https://schema.stenci.la/Heading', itemscope: '' },
0,
]
},
Expand All @@ -201,7 +201,7 @@ function list(): NodeSpec {
toDOM(node) {
return [
node.attrs.order === 'Unordered' ? 'ul' : 'ol',
{ itemtype: 'http://schema.org/ItemList', itemscope: '' },
{ itemtype: 'https://schema.org/ItemList', itemscope: '' },
0,
]
},
Expand All @@ -222,7 +222,7 @@ function listItem(): NodeSpec {
toDOM(_node) {
return [
'li',
{ itemtype: 'http://schema.org/ListItem', itemscope: '' },
{ itemtype: 'https://schema.org/ListItem', itemscope: '' },
0,
]
},
Expand All @@ -249,7 +249,7 @@ function codeFragment(): NodeSpec {
toDOM(_node) {
return [
'code',
{ itemtype: 'http://schema.stenci.la/CodeFragment', itemscope: '' },
{ itemtype: 'https://schema.stenci.la/CodeFragment', itemscope: '' },
0,
]
},
Expand All @@ -275,7 +275,7 @@ function table(): NodeSpec {
toDOM(_node) {
return [
'table',
{ itemtype: 'http://schema.org/Table', itemscope: '' },
{ itemtype: 'https://schema.org/Table', itemscope: '' },
['tbody', 0],
]
},
Expand All @@ -294,7 +294,7 @@ function tableRow(): NodeSpec {
toDOM(_node) {
return [
'tr',
{ itemtype: 'http://schema.stenci.la/TableRow', itemscope: '' },
{ itemtype: 'https://schema.stenci.la/TableRow', itemscope: '' },
0,
]
},
Expand Down Expand Up @@ -334,7 +334,7 @@ function tableCellAttrsGet(dom: HTMLElement): Record<string, unknown> {
*/
function tableCellAttrsSet(node: Node): Record<string, string | number> {
const attrs: Record<string, string | number> = {
itemtype: 'http://schema.stenci.la/TableCell',
itemtype: 'https://schema.stenci.la/TableCell',
itemscope: '',
}

Expand Down Expand Up @@ -400,7 +400,7 @@ function thematicBreak(): NodeSpec {
toDOM(_node) {
return [
'hr',
{ itemtype: 'http://schema.stenci.la/ThematicBreak', itemscope: '' },
{ itemtype: 'https://schema.stenci.la/ThematicBreak', itemscope: '' },
]
},
}
Expand All @@ -424,7 +424,7 @@ function _inline(
toDOM(_node) {
return [
tag,
{ itemtype: `http://schema.stenci.la/${name}`, itemscope: '' },
{ itemtype: `https://schema.stenci.la/${name}`, itemscope: '' },
0,
]
},
Expand Down
2 changes: 1 addition & 1 deletion web/src/patches/dom/transform.ts
Expand Up @@ -120,7 +120,7 @@ export function changeTagName(elem: Element, tag: string, type?: string): void {
for (let index = 0; index < elem.attributes.length; index++) {
const attr = elem.attributes[index] as Attr
if (attr.name === 'itemtype' && type !== undefined) {
changed.setAttribute(attr.name, `http://schema.stenci.la/${type}`)
changed.setAttribute(attr.name, `https://schema.stenci.la/${type}`)
} else {
changed.setAttribute(attr.name, attr.value)
}
Expand Down

0 comments on commit 89f261a

Please sign in to comment.