Socket
Book a DemoInstallSign in
Socket

tungtung-test-module

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

tungtung-test-module

## Install ---

unpublished
latest
npmnpm
Version
1.0.10
Version published
Maintainers
1
Created
Source

TUNGTUNG SUPER EDITOR

Install

Install tungtung-super-editor

yarn add tungtung-super-editor
# or with npm
# npm install --save tungtung-super-editor

2. Add style to ...

For Example rekit | create-react-app : update file public/index.html next.js : update file pages/_document.js

<!-- Import Editor-Style -->
<link
    rel='stylesheet'
    href='https://tungtung-space.sgp1.cdn.digitaloceanspaces.com/static/community/css/style.min.css'
/>
<!-- Import Editor-Font -->
<link
    rel='stylesheet'
    href='https://tungtung-space.sgp1.cdn.digitaloceanspaces.com/static/community/css/fonts.css'
/>
<!-- Import Editor-CodemirrorStyle -->
<link
    key='codemirror'
    rel='stylesheet'
    href='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/codemirror.min.css'
/>
<!-- Import Editor-KaTeXStyle -->
<link
    rel='stylesheet'
    href='https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.min.css'
    integrity='sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j'
    crossOrigin='anonymous'
/>

The third step is add LatexPopover and ToolBarPopover to Root App

For Example rekit | create-react-app : update file src/index.js next.js : update file pages/_document.js

import {
    LatexPopover,
    ToolBarPopover
} from 'tungtung-super-editor/dist/style'

...

<LatexPopover id='slate_latexPopover' className='fadeIn animated' />
<ToolBarPopover id='slate_toolbarPopover' className='faster' />

Usage

1 . Require tungtung-super-editor after installation

import Editor from 'tungtung-test-module'

2 . Include tungtung-super-editor component

...
render () {
    return (
        <Editor
            onChange={this.handleChange}
            value={this.props.question.content}
            placeholder='Enter content ...'
            ... // For more, let's view Props Section
        />
    )
}
...

Props

value

TypeRequiredDefault ValueDescription
ObjectNoInitialize the initial value for the editor.
const initValue = {
    document: {
        nodes: [
          {
            object: 'block',
            type: 'paragraph',
            nodes: [
              {
                object: 'text',
                leaves: [
                  {
                    text: ''
                  }
                ]
              }
            ]
          }
        ]
    }
}

...

render () {
    return (
        <Editor value={initValue} />
    )
}

placeholder

TypeRequiredDefault ValueDescription
StringNoSuper Editor!
...
render () {
    return (
        <Editor placeholder='Enter content ...' />
    )
}
...

onChange

TypeRequiredDefault ValueDescription
FunctionNo
Example
...

handleChange = value => this.setState({ questionContent: value })

render () {
    return (
        <Editor onChange={handleChange} />
    )
}

...

readOnly

TypeRequiredDefault ValueDescription
BooleanNofalseif true, user can only view content. If false, user can edit the content.
...
render () {
    return (
        <Editor readOnly /> // User can only view content
    )
}
...

FAQs

Package last updated on 22 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts