create account

Update--- KnackSteem Editor and Refactor of the sidebar component across the Application by sirfreeman

View this thread on: hive.blogpeakd.comecency.com
· @sirfreeman · (edited)
$40.00
Update--- KnackSteem Editor and Refactor of the sidebar component across the Application
## Repository
https://github.com/knacksteem/knacksteem.org 

## Pull Request 
https://github.com/knacksteem/knacksteem.org/pull/52  

![](https://cdn.steemitimages.com/DQmb7UCWRabcT2KgHhc5S7V63kmUKvRJFJPku4rT1mz4XFG/image.png)

![](https://cdn.steemitimages.com/DQmZ6ojCkGKVN8MkYjQkjoJBMB4Bgz5XhFSYNYeWvFfioUd/image.png)

This Pr add a new Editor in the knackSteem Project, The editor accepts functionalities like drag and drop, File clicking, Pasting files. Also a refactor of the App layout to add the side bar component through out the application.

## What did i use?
Building this Editor, the following packages were used

1. React-dropzone
2. React-hotkeys

React dropzone was used to handle drag and drop events on the editor, while React hotkeys was used to handle key events on the editor.


 

```js
insertAtCursor = (before, after, deltaStart = 0, deltaEnd = 0) => {
if (!this.input) return;
const startPos = this.input.selectionStart;
const endPos = this.input.selectionEnd;
this.input.value =
this.input.value.substring(0, startPos) +
before +
this.input.value.substring(startPos, endPos) +
after +
this.input.value.substring(endPos, this.input.value.length);
this.input.selectionStart = startPos + deltaStart;
this.input.selectionEnd = endPos + deltaEnd;
};

```

The above method insert at the cursor position in the text editor, simply by getting the starting and ending position of the cursor.
```
 
handlePastedImage = (e) => {
if (e.clipboardData && e.clipboardData.items) {
const items = e.clipboardData.items;
Array.from(items).forEach((item) => {
if (item.kind === 'file') {
e.preventDefault();

this.setState({
           imageUploading: true,
});

const blob = item.getAsFile();
this.props.onImageInserted(blob, this.insertImage, () =>
this.setState({
             imageUploading: false,
}),
         );
}
});
}
};
```
The above code handle pasted images screenshot on the editor, which is gotten from the clipboard.

## Issue
https://github.com/knacksteem/knacksteem.org/issues/34

## Task Request
https://steemit.com/knacksteem/@knowledges/development-task-request-help-build-knacksteem-front-end-800-steem-bounty 

## What's next?
The next pull for this task will be a refactor of the Editor area and to add a toggle side bar across the application for moderation functionality and basic navigation.  In the future, i will also like to add draft functionality on the editor.

## Commits 
https://github.com/knacksteem/knacksteem.org/pull/52/commits/2aca5f82e88279eeb3bb70c1cad29e97776e546d

https://github.com/knacksteem/knacksteem.org/pull/52/commits/7220c5d708ad666a7015cb427822f7befb7f612f

https://github.com/knacksteem/knacksteem.org/pull/52/commits/3e1f911654a13cf297e6eda25b45f6aaed705270

https://github.com/knacksteem/knacksteem.org/pull/52/commits/7ee61675f1395e84f8ff25a4debaa10d2c89979b

https://github.com/knacksteem/knacksteem.org/pull/52/commits/463d719b6ad6cbb130326f2370f549f9d823b397 

## Github Account
https://github.com/ogbiyoyosky
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 84 others
properties (23)
authorsirfreeman
permlinkupdate-knacksteem-editor-and-refactor-of-the-sidebar-component-across-the-application
categoryutopian-io
json_metadata{"tags":["utopian-io","development","knacksteem","programming","reactjs"],"links":["https://github.com/knacksteem/knacksteem.org","https://github.com/knacksteem/knacksteem.org/pull/52","https://github.com/knacksteem/knacksteem.org/issues/34","https://steemit.com/knacksteem/@knowledges/development-task-request-help-build-knacksteem-front-end-800-steem-bounty","https://github.com/knacksteem/knacksteem.org/pull/52/commits/2aca5f82e88279eeb3bb70c1cad29e97776e546d","https://github.com/knacksteem/knacksteem.org/pull/52/commits/7220c5d708ad666a7015cb427822f7befb7f612f","https://github.com/knacksteem/knacksteem.org/pull/52/commits/3e1f911654a13cf297e6eda25b45f6aaed705270","https://github.com/knacksteem/knacksteem.org/pull/52/commits/7ee61675f1395e84f8ff25a4debaa10d2c89979b","https://github.com/knacksteem/knacksteem.org/pull/52/commits/463d719b6ad6cbb130326f2370f549f9d823b397","https://github.com/ogbiyoyosky"],"app":"steemit/0.1","format":"markdown","image":["https://cdn.steemitimages.com/DQmb7UCWRabcT2KgHhc5S7V63kmUKvRJFJPku4rT1mz4XFG/image.png","https://cdn.steemitimages.com/DQmZ6ojCkGKVN8MkYjQkjoJBMB4Bgz5XhFSYNYeWvFfioUd/image.png"]}
created2018-11-26 15:31:48
last_update2018-11-26 15:47:42
depth0
children4
last_payout2018-12-03 15:31:48
cashout_time1969-12-31 23:59:59
total_payout_value30.351 HBD
curator_payout_value9.644 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,979
author_reputation13,136,718,943,137
root_title"Update--- KnackSteem Editor and Refactor of the sidebar component across the Application"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id75,940,407
net_rshares64,798,198,752,443
author_curate_reward""
vote details (148)
@helo ·
$9.94
- Good work on the new functionality
- Listing the commits seem a bit redundant since you listed the PR.
- Many functions have comment blocks, yet nothing written in them.

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/2211122).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , ,
properties (23)
authorhelo
permlinkre-sirfreeman-update-knacksteem-editor-and-refactor-of-the-sidebar-component-across-the-application-20181127t124131018z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/3/2211122","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2018-11-27 12:41:30
last_update2018-11-27 12:41:30
depth1
children1
last_payout2018-12-04 12:41:30
cashout_time1969-12-31 23:59:59
total_payout_value7.522 HBD
curator_payout_value2.418 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length662
author_reputation121,547,934,535,311
root_title"Update--- KnackSteem Editor and Refactor of the sidebar component across the Application"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id75,986,013
net_rshares16,164,023,839,236
author_curate_reward""
vote details (13)
@utopian-io ·
Thank you for your review, @helo! Keep up the good work!
properties (22)
authorutopian-io
permlinkre-re-sirfreeman-update-knacksteem-editor-and-refactor-of-the-sidebar-component-across-the-application-20181127t124131018z-20181129t204148z
categoryutopian-io
json_metadata"{"app": "beem/0.20.9"}"
created2018-11-29 20:41:51
last_update2018-11-29 20:41:51
depth2
children0
last_payout2018-12-06 20:41:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length56
author_reputation152,955,367,999,756
root_title"Update--- KnackSteem Editor and Refactor of the sidebar component across the Application"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,114,756
net_rshares0
@steem-ua ·
#### Hi @sirfreeman!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
authorsteem-ua
permlinkre-update-knacksteem-editor-and-refactor-of-the-sidebar-component-across-the-application-20181127t124303z
categoryutopian-io
json_metadata"{"app": "beem/0.20.9"}"
created2018-11-27 12:43:03
last_update2018-11-27 12:43:03
depth1
children0
last_payout2018-12-04 12:43:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length289
author_reputation23,214,230,978,060
root_title"Update--- KnackSteem Editor and Refactor of the sidebar component across the Application"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id75,986,072
net_rshares0
@utopian-io ·
Hey, @sirfreeman!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-update-knacksteem-editor-and-refactor-of-the-sidebar-component-across-the-application-20181128t000307z
categoryutopian-io
json_metadata"{"app": "beem/0.20.9"}"
created2018-11-28 00:03:09
last_update2018-11-28 00:03:09
depth1
children0
last_payout2018-12-05 00:03:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length592
author_reputation152,955,367,999,756
root_title"Update--- KnackSteem Editor and Refactor of the sidebar component across the Application"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,013,898
net_rshares0