1.0.0 • Published 2 years ago

@ct-note/header v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Heading Tool

Version of EditorJS that the plugin is compatible with

Provides Headings Blocks for the Editor.js.

Installation

Install via NPM

Get the package

npm i --save @editorjs/header

Include module at your application

const Header = require('@editorjs/header');

Download to your project's source dir

  1. Upload folder dist from repository
  2. Add dist/bundle.js file to your page.

Load from CDN

You can load specific version of package from jsDelivr CDN.

https://cdn.jsdelivr.net/npm/@editorjs/header@latest

Then require this script on page with Editor.js.

<script src="..."></script>

Usage

Add a new Tool to the tools property of the Editor.js initial config.

var editor = EditorJS({
  ...

  tools: {
    ...
    header: Header,
  },

  ...
});

Shortcut

You can insert this Block by a useful shortcut. Set it up with the tools[].shortcut property of the Editor's initial config.

var editor = EditorJS({
  ...

  tools: {
    ...
    header: {
      class: Header,
      shortcut: 'CMD+SHIFT+H',
    },
  },

  ...
});

Config Params

All properties are optional.

FieldTypeDescription
placeholderstringheader's placeholder string
levelsnumber[]enabled heading levels
defaultLevelnumberdefault heading level
var editor = EditorJS({
  ...

  tools: {
    ...
    header: {
      class: Header,
      config: {
        placeholder: 'Enter a header',
        levels: [2, 3, 4],
        defaultLevel: 3
      }
    }
  }

  ...
});

Tool's settings

An image showing the header block tool

You can select one of six levels for heading.

Output data

FieldTypeDescription
textstringheader's text
levelnumberlevel of header: 1 for H1, 2 for H2 ... 6 for H6
{
  "type": "header",
  "data": {
    "text": "Why Telegram is the best messenger",
    "level": 2
  }
}
ajvacornajv-keywordsansi-regexajv-errorsanymatchansi-stylesaprobaarr-flattenarr-unionarr-diffasn1.jsassertassign-symbolsarray-uniqueasync-eachbabel-code-frameatobbabel-plugin-dynamic-import-nodebalanced-matchbasebase64-jsbig.jsbn.jsbinary-extensionsbrace-expansionbluebirdbracesbrowserify-aesbrowserify-cipherbrorandbrowserify-desbrowserify-rsabrowserify-zlibbrowserify-signbrowserslistbufferbuiltin-status-codesbuffer-xorbuffer-fromcacachecache-basecamelcasecaniuse-litechalkchownrchokidarchrome-trace-eventcipher-baseclass-utilscliuicollection-visitcolor-convertcolorettecolor-namecommandercommondircomponent-emitterconcat-mapconcat-streamconsole-browserifyconstants-browserifyconvert-source-mapcopy-concurrentlycopy-descriptorcore-js-compatcore-util-iscreate-ecdhcreate-hashcreate-hmaccross-spawncrypto-browserifycss-selector-tokenizercssesccyclistdebugdecamelizedecode-uri-componentdefine-propertiesdefine-propertydes.jsdetect-filedomain-browserduplexifydiffie-hellmanelectron-to-chromiumellipticemoji-regexemojis-listend-of-streamerrnoenhanced-resolveescaladeescape-string-regexpeslint-scopeesrecurseestraverseesutilsevp_bytestokeyeventsexecaexpand-tildeextend-shallowfast-deep-equalextglobfast-json-stable-stringifyfastparsefiggy-puddingexpand-bracketsfind-cache-dirfill-rangefind-upfindup-syncflush-write-streamfor-infragment-cachefrom2fs.realpathfunction-bindfs-write-stream-atomicgensyncget-caller-fileget-streamget-valueglobglob-parentglobal-modulesglobalsglobal-prefixgraceful-fshas-ansihas-flaghas-symbolshas-valuehas-valueshash-basehash.jshmac-drbghttps-browserifyicss-replace-symbolshomedir-polyfillicss-utilsieee754iferrimport-localimurmurhashinflightinfer-ownerinheritsiniinterpretinvariantinvert-kvis-accessor-descriptoris-binary-pathis-bufferis-data-descriptoris-descriptoris-extendableis-extglobis-fullwidth-code-pointis-globis-numberis-plain-objectis-streamis-windowsis-wslisarrayisexeisobjectjs-tokensjsescjson-parse-better-errorsjson-schema-traversejson5kind-oflcidlevenlevenaryloader-runnerloader-utilslocate-pathlodashloose-envifylru-cachemake-dirmap-age-cleanermap-cachemap-visitmd5.jsmemmemory-fsmicromatchmiller-rabinmimic-fnminimalistic-assertminimalistic-crypto-utilsminimistmississippimkdirpmove-concurrentlymixin-deepmsnanomatchneo-asyncnice-trynode-libs-browsernormalize-pathnode-releasesnpm-run-pathobject-assignobject-copyobject-keysobject-visitobject.assignobject.pickonceminimatchos-browserifyp-deferos-localep-finallyp-is-promisep-limitp-locatep-tryparallel-transformpakoparse-asn1parse-passwdpascalcasepath-browserifypath-dirnamepath-existspath-is-absolutepath-keypath-parsepbkdf2picomatchpifypkg-dirpostcsspostcss-modules-extract-importspostcss-modules-local-by-defaultpostcss-modules-scopepostcss-modules-valuespostcss-value-parserprivateprocessprocess-nextick-argspromise-inflightprrpublic-encryptpumppumpifypunycodequerystringquerystring-es3randombytesposix-character-classesrandomfillreadable-streamreaddirpregenerateregenerate-unicode-propertiesregenerator-runtimeregenerator-transformregex-notregexpu-coreregjsgenregjsparserremove-trailing-separatorrepeat-elementrepeat-stringrequire-main-filenamerequire-directoryresolveresolve-cwdresolve-dirresolve-fromresolve-urlretrimrafripemd160run-queuesafe-buffersafe-regexschema-utilssemverserialize-javascriptset-blockingset-valuesetimmediatesha.jsshebang-regexshebang-commandsignal-exitsnapdragonsnapdragon-nodesnapdragon-utilsource-list-mapsource-mapsource-map-resolvesource-map-supportsource-map-urlsplit-stringssristatic-extendstream-browserifystream-eachstream-httpstream-shiftstring-widthstring_decoderstrip-eofstrip-ansisupports-colortapableterserterser-webpack-plugintimers-browserifythrough2to-arraybufferto-object-pathto-fast-propertiesto-regexto-regex-rangetslibtty-browserifyunicode-canonical-property-names-ecmascripttypedarrayunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascriptunion-valueunique-filenameunique-slugunset-valueurixupathurluseutiluri-jsutil-deprecatev8-compile-cachevm-browserifywatchpackwatchpack-chokidar2webpack-sourceswhichwhich-modulewrap-ansiworker-farmwrappyxtendy18nyallistyargsyargs-parser
1.0.0

2 years ago