Skip to content

Commit

Permalink
added ids to H1 tags
Browse files Browse the repository at this point in the history
  • Loading branch information
eyesore- committed Jan 18, 2017
1 parent f6a0c45 commit 838a5df
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
20 changes: 20 additions & 0 deletions client/js/editor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
import Quill from 'quill'
import docsave from './docsave.js'
import Chance from 'chance'

const chance = new Chance()

const Block = Quill.import('blots/block')

class Header extends Block {
static formats(domNode) {
if (!domNode.id) {
let time = '' + Date.now()
domNode.id = `th-${chance.word({length: 3}) + time.slice(-3)}`
}
return this.tagName.indexOf(domNode.tagName) + 1
}
}

Header.blotName = 'header'
Header.tagName = ['H1', 'H2']

Quill.register('formats/header', Header, true)

module.exports = {
quill: '',
Expand Down
4 changes: 0 additions & 4 deletions client/vue-components/main_content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,4 @@ html, body{
code {
color: #f66;
}
<<<<<<< a897181742249f80925d321e795883f007dc95c1
</style>
=======
</style>
>>>>>>> added database to be ignored
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"dependencies": {
"chance": "^1.0.4",
"crypto": "0.0.3",
"css-loader": "^0.23.1",
"email-validator": "^1.0.7",
"express": "^4.14.0",
"http": "0.0.0",
Expand Down

0 comments on commit 838a5df

Please sign in to comment.