react-markdown-editor icon indicating copy to clipboard operation
react-markdown-editor copied to clipboard

Strange text duplicates when clicking a button several times

Open nomad5000 opened this issue 9 years ago • 19 comments

Reproduce:

select a part of the text that you want to apply style to.

Then click the button (bold,...) then click the button again, again and again.

Result will be several times insert of partial test originaly selected + markdown to apply

nomad5000 avatar Nov 03 '16 11:11 nomad5000

Thanks for the catch! Will check.

jrm2k6 avatar Nov 03 '16 16:11 jrm2k6

Yes have a fix for this don't know if it is good style. Just drop selection in the handler for each button

Am Donnerstag, 3. November 2016 schrieb Jeremy Dagorn :

Thanks for the catch! Will check.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258196305, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAaUFe7Twu4sRPcoinwviNPQaA7m5tIks5q6gwSgaJpZM4KoQsO .

nomad5000 avatar Nov 03 '16 16:11 nomad5000

Got it. Will wait for your PR.

jrm2k6 avatar Nov 03 '16 16:11 jrm2k6

hey,

how do I run the tests?

I get following error when doing npm test

FAIL __tests__/markdownEditor-test.js ● Runtime Error SyntaxError: Unexpected token ] at createMockFunction (/Users/michael/GitRepos/react-markdown-editor/node_modules/jest-mock/src/index.js:163:10) at makeComponent (/Users/michael/GitRepos/react-markdown-editor/node_modules/jest-mock/src/index.js:246:9) at generateMock (/Users/michael/GitRepos/react-markdown-editor/node_modules/jest-mock/src/index.js:293:16) at getSlots.forEach.slot (/Users/michael/GitRepos/react-markdown-editor/node_modules/jest-mock/src/index.js:303:20) at Array.forEach (native) at generateMock (/Users/michael/GitRepos/react-markdown-editor/node_modules/jest-mock/src/index.js:298:30) at getSlots.forEach.slot (/Users/michael/GitRepos/react-markdown-editor/node_modules/jest-mock/src/index.js:303:20) at Array.forEach (native) at generateMock (/Users/michael/GitRepos/react-markdown-editor/node_modules/jest-mock/src/index.js:298:30) at getSlots.forEach.slot (/Users/michael/GitRepos/react-markdown-editor/node_modules/jest-mock/src/index.js:303:20)

nomad5000 avatar Nov 04 '16 11:11 nomad5000

OK Solved there was a mock problem with the markup package.

I would like to submit a PR.

Do not have permission to push a branch though

nomad5000 avatar Nov 04 '16 12:11 nomad5000

Actually I checked github's md editor.

It works as follows:

  • Select text
  • Apply Button
  • Markdown around the selected text
  • Text stays selected
  • Press Button again
  • Markdown around text is removed

nomad5000 avatar Nov 04 '16 14:11 nomad5000

Interesting. Thanks for looking into that. So far I used this package in two projects without issues, but I can see I need to work on adding more features. If you want to submit a PR you should fork the repo, create a branch on your fork and submit a PR later.

Can I ask in what context you are using this package?

jrm2k6 avatar Nov 04 '16 16:11 jrm2k6

Hi, I want to start using react and was building my first use case.

Then I required a md editor.

So I started to look around.

I found yours was the easiest to install.

So now I'm wondering if I could just do 2 things at once.

Contribute and learn react :)

That's the reason I'm interested

Am Freitag, 4. November 2016 schrieb Jeremy Dagorn :

Interesting. Thanks for looking into that. So far I used this package in two projects without issues, but I can see I need to work on adding more features. If you want to submit a PR you should fork the repo, create a branch on your fork and submit a PR later.

Can I ask in what context you are using this package?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258477008, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAaUBOgzCyYvOjPBG6-19YESPEjV6Grks5q61rRgaJpZM4KoQsO .

nomad5000 avatar Nov 04 '16 16:11 nomad5000

Alright, do not hesitate to fork the repo, work on it and let me know if you have any questions!

jrm2k6 avatar Nov 04 '16 16:11 jrm2k6

Yes I will,

One thing. I want to change the code of the library and use the updated library when running the examples. Is there a proper way to do that.

Right now I always have to

Rm -rf node_modules

Then rpm i

That sucks terribly

Am Freitag, 4. November 2016 schrieb Jeremy Dagorn :

Alright, do not hesitate to fork the repo, work on it and let me know if you have any questions!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258484310, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAaUJx5k-4s2PEp8CHbLgYAq-D14nEFks5q62ESgaJpZM4KoQsO .

nomad5000 avatar Nov 04 '16 17:11 nomad5000

You should be able to use npm link: https://docs.npmjs.com/cli/link

jrm2k6 avatar Nov 04 '16 18:11 jrm2k6

I tried but I get some errors that I can't fix with that approach

Am Freitag, 4. November 2016 schrieb Jeremy Dagorn :

You should be able to use npm link: https://docs.npmjs.com/cli/link

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258518750, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAaUHIYoPr1vdnts7oKmRKIZ6t4EiuCks5q63_DgaJpZM4KoQsO .

nomad5000 avatar Nov 04 '16 19:11 nomad5000

What are the errors you are receiving?

On Fri, Nov 4, 2016 at 12:01 PM nomad5000 [email protected] wrote:

I tried but I get some errors that I can't fix with that approach

Am Freitag, 4. November 2016 schrieb Jeremy Dagorn :

You should be able to use npm link: https://docs.npmjs.com/cli/link

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258518750 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AEAaUHIYoPr1vdnts7oKmRKIZ6t4EiuCks5q63_DgaJpZM4KoQsO

.

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258519959, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCaY98xbUbWCLTlW1rjv5_IKjezncb9ks5q64DwgaJpZM4KoQsO .

jrm2k6 avatar Nov 04 '16 19:11 jrm2k6

Michaels-MBP:Example michael$ webpack Hash: 12e432292ea5f1a86e8a Version: webpack 1.13.3 Time: 2372ms Asset Size Chunks Chunk Names bundle.js 742 kB 0 [emitted] bundle bundle.js.map 865 kB 0 [emitted] bundle [0] multi bundle 28 bytes {0} [built] + 174 hidden modules

ERROR in ../index.js Module build failed: ReferenceError: [BABEL] /Users/michael/GitRepos/react-markdown-editor/index.js: Unknown option: /Users/michael/GitRepos/react-markdown-editor/node_modules/react/react.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.

A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

Invalid: { presets: [{option: value}] } Valid: { presets: [['presetName', {option: value}]] }

For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options. (While processing preset: "/Users/michael/GitRepos/react-markdown-editor/node_modules/react/react.js") at Logger.error (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/logger.js:41:11) at OptionManager.mergeOptions (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:221:20) at /Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:260:14 at /Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:329:22 at Array.map (native) at OptionManager.resolvePresets (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:270:20) at OptionManager.mergePresets (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:259:10) at OptionManager.mergeOptions (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:244:14) at OptionManager.init (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12) at File.initOptions (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/index.js:216:65) at new File (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/file/index.js:139:24) at Pipeline.transform (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-core/lib/transformation/pipeline.js:46:16) at transpile (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-loader/index.js:38:20) at Object.module.exports (/Users/michael/GitRepos/react-markdown-editor/Example/node_modules/babel-loader/index.js:131:12) @ ./index.js 3:26-58

Am 04.11.2016 um 20:02 schrieb Jeremy Dagorn [email protected]:

What are the errors you are receiving?

On Fri, Nov 4, 2016 at 12:01 PM nomad5000 [email protected] wrote:

I tried but I get some errors that I can't fix with that approach

Am Freitag, 4. November 2016 schrieb Jeremy Dagorn :

You should be able to use npm link: https://docs.npmjs.com/cli/link

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258518750 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AEAaUHIYoPr1vdnts7oKmRKIZ6t4EiuCks5q63_DgaJpZM4KoQsO

.

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258519959, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCaY98xbUbWCLTlW1rjv5_IKjezncb9ks5q64DwgaJpZM4KoQsO .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258520347, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAaUOigLg72Ohcm6EmIyxk0OFc1eZnRks5q64FTgaJpZM4KoQsO.

nomad5000 avatar Nov 04 '16 19:11 nomad5000

I can check this a little bit later. I am still at work sorry!

jrm2k6 avatar Nov 04 '16 19:11 jrm2k6

No Problem,

It’s late here I will check tomorrow.

;)

I think it has something to do with webpack not being able to handle symbolic links

Am 04.11.2016 um 20:51 schrieb Jeremy Dagorn [email protected]:

I can check this a little bit later. I am still at work sorry!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258531073, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAaUMlVHedNQ7K_D8UjrD6F5lIt-3LWks5q64zTgaJpZM4KoQsO.

nomad5000 avatar Nov 04 '16 19:11 nomad5000

http://webpack.github.io/docs/troubleshooting.html#npm-linked-modules-doesn-t-find-their-dependencies

This might be the solution :) Am Freitag, 4. November 2016 schrieb Michael Schmidt :

No Problem,

It’s late here I will check tomorrow.

;)

I think it has something to do with webpack not being able to handle symbolic links

Am 04.11.2016 um 20:51 schrieb Jeremy Dagorn <[email protected] javascript:_e(%7B%7D,'cvml','[email protected]');>:

I can check this a little bit later. I am still at work sorry!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-258531073, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAaUMlVHedNQ7K_D8UjrD6F5lIt-3LWks5q64zTgaJpZM4KoQsO .


Michael Schmidt,

Web Developer / Consultant

Michael Schmidt, Eisnacherstr. 71, 10823, Berlin, Germany

+49-157-85925901

[email protected]

www.webkrafts.net

nomad5000 avatar Nov 04 '16 20:11 nomad5000

Any news on this? Were you able to have your symlink working?

jrm2k6 avatar Nov 16 '16 22:11 jrm2k6

Hi Jeremy,

No I couldn't get it to work.

I'm kind of busy now with a new project in the oven 😄.

Actually they needed a markdown editor for a cms type of backend. They used pagedown.

I would really like to contribute to your editor.

I see one thing that would keep me from using it in production.

For one: the size of the react... package is kind of large ~ 1MB

I would really like to work with you on this one. I understand React pretty well now. What I'm having issues with is node ( the links) and I haven't read anything about reflux.

The fix for this issue that was easy to implement with my knowledge level, was to automatically deselect after applying a button. That is not quiet the behavior I would like.

It would be better to remove styling on the selection when clicking a second time.

Jeremy Dagorn [email protected] schrieb am Mi. 16. Nov. 2016 um 23:38:

Any news on this? Were you able to have your symlink working?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrm2k6/react-markdown-editor/issues/35#issuecomment-261095570, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAaUOterEG5S58wfQwAUHZ9vPuhmFi3ks5q-4XsgaJpZM4KoQsO .

nomad5000 avatar Nov 17 '16 11:11 nomad5000