Comments (6)
Probably would have saved us time if it just said that I was missing an editorView element :) We were unintentionally initializing an editor without an element
from prosemirror-menu.
I'm not sure if what I'm about to suggest would resolve this issue, but let's give it a shot. Are you sure that there is a div with editor id in your DOM? By default, document.querySelector("#editor")
is invoked while setting up EditorView
.
from prosemirror-menu.
By default, document.querySelector("#editor") is invoked while setting up EditorView.
No, that's not accurate—the library will append to the element is it given, and doesn't hard-code any specific ids.
Not sure why I missed this issue initially. @rj-david Did you solve this? If not, you're going to have to provide more details.
from prosemirror-menu.
Yes, I missed one crucial piece of information, and as such, my previous comment is not accurate. I wanted to point out that the code resulting in the error might have originated from the basic example. If so, it seems that the div with editor id was not present in DOM. I used the code snippet from the URL above and had an error with the same title. After adding a div with editor id to DOM prior to the script execution, the issue was resolved for me.
from prosemirror-menu.
We are hitting this constantly in production (we are working on a different editor that doesn't use prosemirror-menu):
+-----------------------------------------------------------------------+-------------------------------------------------------------+------+--------+
| function | file | line | column |
+-----------------------------------------------------------------------+-------------------------------------------------------------+------+--------+
| editorView.dom.parentNode.replaceChild(this.wrapper, editorView.dom); | webpack:///./node_modules/prosemirror-menu/dist/index.es.js | 670 | 28 |
| return new MenuBarView(editorView, options); | webpack:///./node_modules/prosemirror-menu/dist/index.es.js | 653 | 13 |
| this.pluginViews.push(plugin.spec.view(this)); | webpack:///./node_modules/prosemirror-view/dist/index.es.js | 6771 | 42 |
| this.updatePluginViews(); | webpack:///./node_modules/prosemirror-view/dist/index.es.js | 6584 | 7 |
| let view = new EditorView(editor, { | webpack:///./app/javascript/etc/prosemirror.js | 16 | 15 |
| document.querySelectorAll('.markdown-content').forEach(mdc => { | webpack:///./app/javascript/etc/prosemirror.js | 12 | 49 |
| }), (null != u ? u : document).dispatchEvent(i), i; | webpack:///./node_modules/turbolinks/dist/turbolinks.js | 75 | 39 |
| return null == t && (t = {}), e.dispatch("turbolinks:load", { | webpack:///./node_modules/turbolinks/dist/turbolinks.js | 994 | 42 |
| return this.notifyApplicationAfterPageLoad(t.getTimingMetrics()); | webpack:///./node_modules/turbolinks/dist/turbolinks.js | 1007 | 22 |
+-----------------------------------------------------------------------+-------------------------------------------------------------+------+--------+
from prosemirror-menu.
That would happen when you create an editor that isn't in the DOM. We could add a condition to not call replaceChild
in that situation, but that would mean you wouldn't see the menu bar, which is probably also not what you're looking for. So for now my advice would be to make sure you're not using the menu with 'detached' editors (that were created with null as first constructor argument)
from prosemirror-menu.
Related Issues (17)
- Documentation for undoItem and redoItem is incorrect HOT 2
- render isn't recognized as one of the three MenuItem spec options HOT 4
- Docs around MenuItemSpec are incorrect
- Floating bar in additional scrollable parent isn't placed correctly
- The menu buttons are spans, semantically they should be buttons HOT 1
- Add class option to DropdownSubmenu
- execEvent is not working HOT 1
- The documentation for the Fragment class does have information about the content property HOT 4
- iOS - Sticky toolbar does not stick HOT 4
- Icons are invisible if Prosemirror is inside Shadow DOM HOT 3
- Menu Toolbar expands as much as the height of the window after refresh HOT 1
- List CSS file in package exports HOT 1
- Uncaught TypeError: Cannot read properties of null (reading 'createElement') HOT 2
- A way to add multiple CSS classes to MenuItem and CSS class to outside Prosemirror-menuitem
- Pasting clipboard data raises exception in IE11 HOT 4
- For MenuBarEditorView support place argument being an object with a mount property HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prosemirror-menu.