mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-24 07:39:42 +02:00
Allow inline-code in Header (#64)
* Allow inline-code in Header resolves #59 - add `striptags` for titles - upgrade editor and tools - show page title in html * Add line break
This commit is contained in:
parent
f87fd72fcb
commit
11b796bcc7
9 changed files with 76 additions and 86 deletions
|
@ -1,18 +1,22 @@
|
|||
import EditorJS from '@editorjs/editorjs';
|
||||
|
||||
/**
|
||||
* Tools for the Editor
|
||||
* Block Tools for the Editor
|
||||
*/
|
||||
import Header from '@editorjs/header';
|
||||
import Quote from '@editorjs/quote';
|
||||
import Marker from '@editorjs/marker';
|
||||
import CodeTool from '@editorjs/code';
|
||||
import Delimiter from '@editorjs/delimiter';
|
||||
import InlineCode from '@editorjs/inline-code';
|
||||
import List from '@editorjs/list';
|
||||
import Image from '@editorjs/image';
|
||||
import RawTool from '@editorjs/raw';
|
||||
import Embed from '@editorjs/embed';
|
||||
// import RawTool from '@editorjs/raw';
|
||||
// import Embed from '@editorjs/embed';
|
||||
// import Quote from '@editorjs/quote';
|
||||
|
||||
/**
|
||||
* Inline Tools for the Editor
|
||||
*/
|
||||
import InlineCode from '@editorjs/inline-code';
|
||||
import Marker from '@editorjs/marker';
|
||||
|
||||
/**
|
||||
* Class for working with Editor.js
|
||||
|
@ -30,37 +34,36 @@ export default class Editor {
|
|||
tools: {
|
||||
header: {
|
||||
class: Header,
|
||||
inlineToolbar: ['link', 'marker'],
|
||||
inlineToolbar: ['link', 'marker', 'inlineCode'],
|
||||
config: {
|
||||
placeholder: options.headerPlaceholder || ''
|
||||
}
|
||||
},
|
||||
quote: {
|
||||
class: Quote,
|
||||
inlineToolbar: true
|
||||
},
|
||||
|
||||
// quote: {
|
||||
// class: Quote,
|
||||
// inlineToolbar: true
|
||||
// },
|
||||
|
||||
code: {
|
||||
class: CodeTool,
|
||||
shortcut: 'CMD+SHIFT+D'
|
||||
},
|
||||
rawTool: {
|
||||
class: RawTool,
|
||||
shortcut: 'CMD+SHIFT+R'
|
||||
},
|
||||
|
||||
// rawTool: {
|
||||
// class: RawTool,
|
||||
// shortcut: 'CMD+SHIFT+R'
|
||||
// },
|
||||
|
||||
delimiter: Delimiter,
|
||||
embed: Embed,
|
||||
inlineCode: {
|
||||
class: InlineCode,
|
||||
shortcut: 'CMD+SHIFT+C'
|
||||
},
|
||||
marker: {
|
||||
class: Marker,
|
||||
shortcut: 'CMD+SHIFT+M'
|
||||
},
|
||||
|
||||
// embed: Embed,
|
||||
|
||||
list: {
|
||||
class: List,
|
||||
inlineToolbar: true
|
||||
},
|
||||
|
||||
image: {
|
||||
class: Image,
|
||||
inlineToolbar: true,
|
||||
|
@ -78,6 +81,19 @@ export default class Editor {
|
|||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Inline Tools
|
||||
*/
|
||||
inlineCode: {
|
||||
class: InlineCode,
|
||||
shortcut: 'CMD+SHIFT+C'
|
||||
},
|
||||
|
||||
marker: {
|
||||
class: Marker,
|
||||
shortcut: 'CMD+SHIFT+M'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{% else %}
|
||||
href="/page/{{ firstLevelPage._id }}"
|
||||
{% endif %}>
|
||||
{{ firstLevelPage.title }}
|
||||
{{ firstLevelPage.title | striptags }}
|
||||
</a>
|
||||
{% if firstLevelPage.children is not empty %}
|
||||
<ul class="docs-aside__section-list">
|
||||
|
@ -22,7 +22,7 @@
|
|||
{% else %}
|
||||
href="/page/{{ child._id }}"
|
||||
{% endif %}>
|
||||
{{ child.title }}
|
||||
{{ child.title | striptags }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<header class="docs-header">
|
||||
<a href="/" class="docs-header__logo">
|
||||
{{ config.title }}
|
||||
{{ config.title | striptags }}
|
||||
</a>
|
||||
<ul class="docs-header__menu">
|
||||
{% if isAuthorized == true %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
{% else %}
|
||||
href="/page/{{ option._id }}"
|
||||
{% endif %}>
|
||||
{{ option.title }}
|
||||
{{ option.title | striptags }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ config.title }}</title>
|
||||
<title>{{ (page.title ?: config.title) | striptags }}</title>
|
||||
<link rel="stylesheet" href="/dist/main.css" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:title" content="{{ page.title }}" />
|
||||
<meta property="article:modified_time" content="{{ (page.body.time / 1000) | date("c") }}" />
|
||||
<meta property="og:title" content="{{ page.title | striptags }}" />
|
||||
<meta property="article:modified_time" content="{{ (page.body.time / 1000) | date("c") }}" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue