Skip to content

Instantly share code, notes, and snippets.

View weianofsteel's full-sized avatar

Weian weianofsteel

View GitHub Profile
@weianofsteel
weianofsteel / zhHant.json
Created April 17, 2021 08:15
zhHant.json
{
"title":"試試看",
"greeting":"你好嗎"
}
@weianofsteel
weianofsteel / en.json
Created April 17, 2021 08:13
en.json
{
"title":"try it",
"greeting":"How are you doing"
}
@weianofsteel
weianofsteel / text editor#4
Created April 10, 2021 19:53
text editor#4
options: ['inline', 'blockType', 'fontSize', 'fontFamily', 'list', 'textAlign', 'colorPicker', 'link', 'embedded', 'emoji', 'image', 'remove', 'history']
@weianofsteel
weianofsteel / text editor#3
Created April 10, 2021 19:52
text editor#3
inline: {
inDropdown: false,
className: undefined,
component: undefined,
dropdownClassName: undefined,
options: ['bold', 'italic', 'underline', 'strikethrough', 'monospace', 'superscript', 'subscript'],
bold: { icon: bold, className: undefined },
italic: { icon: italic, className: undefined },
underline: { icon: underline, className: undefined },
strikethrough: { icon: strikethrough, className: undefined },
@weianofsteel
weianofsteel / text editor#2
Created April 10, 2021 15:01
text editor#2
import React, { Component } from 'react';
import { convertToRaw, EditorState } from 'draft-js';
import { Editor } from 'react-draft-wysiwyg';
import '../node_modules/react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
import draftToHtml from 'draftjs-to-html';
export default class TextEditor extends Component{
constructor(props) {
super(props);
this.state = {
@weianofsteel
weianofsteel / text editor#1
Last active April 10, 2021 18:51
text editor#1
import React, { Component } from 'react';
import { Editor } from 'react-draft-wysiwyg';
import '../node_modules/react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
export default class TextEditor extends Component{
constructor(props) {
super(props);
this.state = {
};
@weianofsteel
weianofsteel / dynamic without ssr
Created March 4, 2021 16:00
dynamic without ssr
import dynamic from 'next/dynamic'
const Sample = dynamic(
() => import('../Sample.js'),
{ ssr : false }
)
Const Demo = () => {
return (
<React.Fragment>
@weianofsteel
weianofsteel / dynamic with loading
Created March 4, 2021 15:23
dynamic with loading
import dynamic from 'next/dynamic'
const Sample = dynamic(
() => import('../Sample.js'),
{ loading: ()=> <p>loading...</p> }
)
Const Demo = () => {
return (
<React.Fragment>
@weianofsteel
weianofsteel / next.js dynamic import
Created March 4, 2021 10:46
next.js dynamic import
import dynamic from 'next/dynamic'
const Sample = dynamic(() => import('../Sample.js'))
Const Demo = () => {
return (
<React.Fragment>
<Sample/>
</React.Fragment>
)
@weianofsteel
weianofsteel / React.lazt
Created March 3, 2021 10:47
React.lazt
import React, { Suspense } from 'react';
const Sample = React.lazy(()=> import('./Sample') );
Const Demo = () => {
return(
<React.Fragment>
<Suspense fallback={<div>Loading...</div>}>
<Sample />
</Suspense>
</React.Fragment>