Closed DNonov closed 4 years ago
You are almost done, just change contentEditable={true}
to contentEditable="true"
Hello, I don't think this is the issue here. Because I did it both ways, and the result was the same. However, I found a quote in React Docs about an attribute related to the problem.
suppressContentEditableWarning Normally, there is a warning when an element with children is also marked as contentEditable, because it won’t work. This attribute suppresses that warning. Don’t use this unless you are building a library like Draft.js that manages contentEditable manually.
Given that I went all the way down the tree and added both of the attributes suppressContentEditableWarning
and contentEditable
to the section
element. In hope, this is the last element without children. I've been trying unsuccessfully all sorts of permutations of suppressContentEditableWarning
and contentEditable
just to find if it's a syntax error.
The problem here is deeper than I thought. We need to add contentEditable
attribute to every single leaf in the tree e.g. p
, H1
, H2
etc. Doing so will scatter the preview in many content editable pieces independent of each other. The desired effect to have one big content editable area
containing the whole preview probably would be only possible if we add the attribute contenteditable="true"
post-React or ReactDOM.render()
the whole preview in element that already has contenteditable="true"
.
Any thoughts on this? Thanks in advance.
No, you have to build the code using yarn build-app
Thanks for the fast response.
I ran yarn build-app
.
I used my fork to test and when ran :MarkdownPreview
I had the following error.
[markdown-preview.vim] uncaught exception: Error: ENOENT: no such file or directory, open 'out/_next/static/hrTL4mrT0luNybvNDP1eH/pages/_app.js'
And the section
element with class markdown-body
was empty.
I guess I'm doing something wrong and there is a problem with the build process.
Here is the complete git status
after I did the change and ran yarn install
and yarn build-app
.
modified: app/out/404.html
deleted: app/out/_next/static/~A0xCHcAl1EQY6jjqSLQe/pages/404.js
deleted: app/out/_next/static/~A0xCHcAl1EQY6jjqSLQe/pages/_app.js
deleted: app/out/_next/static/~A0xCHcAl1EQY6jjqSLQe/pages/_error.js
deleted: app/out/_next/static/~A0xCHcAl1EQY6jjqSLQe/pages/index.js
modified: app/out/index.html
modified: app/pages/index.jsx
Any idea what I'm doing wrong? Sorry for the constant stream of questions though. Thanks
setting:
let g:mkdp_preview_options = {
\ 'content_editable': v:true
\ }
Thanks for the feature!
While wondering on the internet to find a way to get grammar support in vim like Grammarly in Chrome. I stumble upon this Reddit thread and there was a user suggesting to use your extension and add
contenteditable="true"
attribute in order Grammarly to kick off. So I did a manual test and add the attribute in the browser and it worked.When I looked in the codebase I thought I only need to add
contentEditable={true}
to the div with id 'page-ctn'. So I edited./app/pages/index.jsx
and addcontentEditable
attribute to the#page-ctn
, however, this attribute was not rendered when:MarkdownPreview
is executed. Here is the render function of./app/pages/index.jsx
after my edit.So can you give me some gudlines how to overcome this problem? If you point me to the right way I can send you a PR.
You can probably agree enabling Grammarly in the preview is a nice thing to have. Especially for non-native English speakers like me.
Thanks for the nice plugin.