0.0.9-alpha • Published 2 years ago

usxeditor v0.0.9-alpha

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

UsxEditor

A React component that displays USX editor control.

Example usage

license builds.sr.ht status

Installation

npm install --save usxeditor

Usage

import React, {useState} from 'react';
import UsxEditor, {UsxFootnoteEditor} from 'UsxEditor';

function App()
{

  const [usx, setUsx] = useState('<usx version="3.0"><para style="p"><verse number="1" style="v"/>hello world</para><para style="s">subheading</para></usx>');

  return (
    <div className="App">
      <header className="App-header">
        
        <div style={{padding: 20}}>React based USX editor technology demo</div>
        
        <div style={{display: 'flex', flexDirection : 'column', width: '80%'}}>
          <UsxEditor
            usx={usx}
            paraMap={['s', 'p']}
            charMap={{'wj' : {}, 'nd' : {style : {'textDecoration' : 'underline' }}}}
            showFootnotePane={true}
            onUsxChanged={(usx: string) => setUsx(usx)}
          />
        </div>
        <div>
          <br /><hr /><br />
          Raw Usx : <span>{usx}</span>
        </div>
      </header>
    </div>
  );
}

export default App;

API

UsxEditor

propdescriptiontypedefault
usxThe usx string to displaystring
paraMapParagraph markersstring[][]
charMapCharacter markersCharacterMarkerDefinitions{}
showFootnotePaneshow/hides footnote panebooleanfalse
showStatusBarshow/hide status barbooleanfalse
onUsxChangedUSX has been modifiedFunction : (usx : string) => void

CharacterMarkerDefinitions

{stylename : CharacterMarkerDefinition, ...}

for example:

{{'wj' : {}, 'nd' : {style : {'textDecoration' : 'underline' }}}}

CharacterMarkerDefinition

{style : css, fontSize : number}
0.0.9-alpha

2 years ago

0.0.8-alpha

2 years ago

0.0.7-alpha

2 years ago

0.0.6-alpha

2 years ago

0.0.5-alpha

2 years ago

0.0.4-alpha

2 years ago

0.0.3-alpha

2 years ago

0.0.2-alpha

2 years ago

0.0.1-alpha

2 years ago