Skip to content

Commit

Permalink
Merge pull request #160 from kommitters/v1.1
Browse files Browse the repository at this point in the history
Release v1.1.16
  • Loading branch information
L-Zuluaga authored Sep 13, 2024
2 parents f158407 + 9ec6509 commit 3132243
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 14 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 1.1.16 (13.09.2024)

* Bundle update (#158). See [PR #158](https://github.com/kommitters/editorjs-drag-drop/pull/158)

## 1.1.15 (06.09.2024)

* Bug fix: Ensure `setAttribute` fires after editor is ready. See [Issue #148](https://github.com/kommitters/editorjs-drag-drop/issues/148)

* Updated README: Added section on plugin usage and customizing the indicator style to enhance documentation clarity.

## 1.1.14 (24.04.2024)

* Update all dependencies. See [PR #131](https://github.com/kommitters/editorjs-drag-drop/pull/131)
Expand Down
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $ npm i --save-dev editorjs-drag-drop
Include module at your application

```javascript
import DragDrop from 'editorjs-drag-drop';
import DragDrop from "editorjs-drag-drop";
```

### Load from CDN
Expand All @@ -38,6 +38,8 @@ Require this script on a page with Editor.js.

## Usage

Add the plugin to the onReady property of the Editor.js configuration to initialize it:

```javascript
const editor = new EditorJS({
onReady: () => {
Expand All @@ -46,11 +48,23 @@ const editor = new EditorJS({
});
```

You can customize the indicator border style by passing a second parameter to the plugin constructor:

```javascript
const editor = new EditorJS({
onReady: () => {
new DragDrop(editor, "2px solid #fff");
},
});
```

If no parameter is provided, the default border style `1px dashed #aaa` is used.

Select the block, drag the toolbar settings button, and drop it at the desired position.

You can optionally provide a second parameter to customize the indicator border style. If no parameter is provided, the default border style `1px dashed #aaa` is used.
### Integration with editorjs-undo

If you're already using [editorjs-undo](https://github.com/kommitters/editorjs-undo), then your code will look somewhat like this:
If you're already using [editorjs-undo](https://github.com/kommitters/editorjs-undo), your code might look like this:

```javascript
const editor = new EditorJS({
Expand All @@ -60,6 +74,7 @@ const editor = new EditorJS({
},
});
```

### Usage with React.

If you are using React, you could create a function to handle the onReady property, the function will store the DragDrop instance. Then, you must call the function in onReady in the editorJS instance.
Expand All @@ -80,15 +95,16 @@ class ReactEditor extends Component {
}
}
```
**Note:** If you are already using [editorjs-undo](https://github.com/kommitters/editorjs-undo) your handleReady function must have the editorjs-undo instance.

**Note:** If you are also using [editorjs-undo](https://github.com/kommitters/editorjs-undo) your handleReady function must have the editorjs-undo instance as well.

```javascript
const handleReady = (editor) => {
new Undo({ editor });
new DragDrop(editor);
};

```

### Usage with [react-editor-js](https://github.com/Jungwoo-An/react-editor-js).

If you are using [react-editor-js](https://github.com/Jungwoo-An/react-editor-js), you should use the 'onInitialize' prop in the ReactEditorJS component to obtain the abstract editorjs as follow:
Expand Down Expand Up @@ -145,18 +161,23 @@ $ yarn test
```

## Code of conduct

We welcome everyone to contribute. Make sure you have read the [CODE_OF_CONDUCT][coc] before.

## Contributing

For information on how to contribute, please refer to our [CONTRIBUTING][contributing] guide.

## Changelog

Features and bug fixes are listed in the [CHANGELOG][changelog] file.

## License

This library is licensed under an MIT license. See [LICENSE][license] for details.

## Acknowledgements

Made with 💙 by [kommitters Open Source](https://kommit.co)

[license]: https://github.com/kommitters/editorjs-drag-drop/blob/master/LICENSE
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "editorjs-drag-drop",
"version": "1.1.14",
"version": "1.1.16",
"keywords": [
"drag",
"drop",
Expand Down
Loading

0 comments on commit 3132243

Please sign in to comment.