1.0.41 • Published 12 days ago

@etsoo/editor v1.0.41

Weekly downloads
-
License
MIT
Repository
github
Last release
12 days ago

EOEditor

ETSOO Free WYSIWYG HTML Editor 亿速思维免费提供的所见即所的HTML编辑器

Access to https://jsfiddle.net/q2mhLufr/ for a quick look. 访问网址 https://jsfiddle.net/q2mhLufr/ 在线快速预览。

Support / 支持

  • Browsers since 2019 (ES2019+), no Internet Exployer support.
  • Custom HTML element/component feature. Easilly integrate with other frameworks like Angular/React/Vue.
  • Splitted fabric into separate file to reduce load size.
  • English and Chinese(简体/繁体).

/ Picture editing / 图片编辑

  • Browser(client) side picture editing like rotate/resize/filter, text.
  • Integrated with Fabric.js (http://fabricjs.com/).

Installing / 安装

Using npm:

$ npm install @etsoo/editor

Using yarn:

$ yarn add @etsoo/editor

Using web: Use CDN or download the file for the latest version. Replace @latest with a specific version like @1.0.5 for it.

<script src="https://cdn.jsdelivr.net/npm/@etsoo/editor@latest/dist/eoeditor.js"></script>
<eo-editor name="content">
	<p>
	Content to be edited here<br>包含编辑的内容
	</p>
</eo-editor>
<script>
// Get the editor reference
const editor = document.querySelector('eo-editor');
if (editor) {
	// Call 'getContent' method to get the editor's content
	const content = editor.getContent();
}
</script>

Using ReactJs: React component wrapper EOEditorEx, or install '@etsoo/reacteditor'

import { EOEditor, IEOEditor } from '@etsoo/editor';
import React from 'react';

/**
 * EOEditor
 */
export type EOEditorExProps = React.DetailedHTMLProps<
  React.HTMLAttributes<IEOEditor>,
  IEOEditor
> &
  Partial<IEOEditor>;

declare global {
  namespace JSX {
    interface IntrinsicElements {
      'eo-editor': EOEditorExProps;
    }
  }
}

// Make sure import the script
const _editor = new EOEditor();

export const EOEditorEx = React.forwardRef<IEOEditor, EOEditorExProps>(
  (props, ref) => {
    const { cloneStyles = false, ...rest } = props;
    return <eo-editor cloneStyles={cloneStyles} ref={ref} {...rest} />;
  }
);

Properties / 属性

NameDescription
activeColorActive color
backupKeyBackup distinguish key
buttonsAll first-level buttons
cloneStylesClone styles to editor
colorMain color
commandsCommands, a supported collection or commands array like 'redo', 'undo'
contentGet or set editor's content
editorContainerEditor container
editorFrameEditor hosted iframe
editorSourceAreaEditor source code textarea
editorToolbarEditor toolbar
editorWindowEditor hosted iframe window
heightHeight of the editor
labelsEditor current labels
languageLanguage of the UI, like en-US, zh-CN, zh-HK
lastClickedButtonEditor last clicked button
nameName for the hidden form input
imageEditorImage editor
popupPopup component
styleWithCSSStyle with CSS or tag
valueEditor's value, alias of content
widthWidth of the editor

Methods / 方法

NameDescription
backupBackup editor content
clearBackupClear backup
createElementCreate element
deleteDelete selection
editImageEdit image
executeCommandExecute command
getBackupGet backup
getDeepestNodeGet deepest node
getFirstElementGet first selection element
getFirstElementGet first range element
getFirstLinkGet first section outer link
getFirstRangeGet first range
getOnlyElementGet the only child element
getSelectionGet selection
insertHTMLInsert HTML text to current selection point
insertImageInsert image
insertTableInsert table
popupBlocksPopup blocks
popupColorsPopup color palette
popupContentPopup HTML content
popupIconsPopup icons
popupStylePopup styles
popupSymbolsPopup symbols
popupSubsPopup subs
restoreFocusRestore focus to the editor iframe
surroundNodeLet first range surround node
tablePropertiesTable properties
unlinkUnlink
1.0.41

12 days ago

1.0.40

13 days ago

1.0.39

2 months ago

1.0.38

2 months ago

1.0.37

2 months ago

1.0.36

2 months ago

1.0.35

3 months ago

1.0.33

8 months ago

1.0.34

8 months ago

1.0.32

12 months ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.2

2 years ago