primefaces-extensions: MonacoEditor: Console error when used twice in seperate tabs
Describe the bug My Page consists of a TabView with several tabs. Two of them each contain one MonacoEditor. When switching tabs from one editor to the other, the following error is thrown in the console. This goes away after reloading via F5.
VM6290:5 Element already has context attribute: ui-monaco-editor-ed
C @ VM6290:5
createScoped @ VM6290:5
e @ VM6290:5
L @ VM6290:5
R @ VM6290:5
(anonymous) @ VM6290:5
W @ VM6290:5
U @ VM6290:5
a._doRender @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:711
a._render @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:710
render @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:464
(anonymous) @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:464
invokeDeferredRenders @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:458
postTabShow @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:539
show @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:539
select @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:539
(anonymous) @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:539
dispatch @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:68
v.handle @ eNp9j9EOwjAIRb9o8r6_qS3bWFuopc1c4scbnXGmOl-4N3DIBZgVBrFVT7PeUqaIg7Go_XypmFfY5N-sS6GOxO2-lYxfrZiEkUvLDhSwpiDGwW4bRm2WEJJhDPDhG2qS4nGFTZpZkWoneFZdKDXXdXgtyErC2v_sHuPnINZXgpc2scSplmjUw9s1hDMFE1mPGXZ7HBeFjRV0VCTDQm7E0hEH4sdHdxLLuWI.js.seam?ln=omnifaces.combined&v=1615471860000:68
Reproducer Will work on this later. The combined resources handler currently makes it quite unreadable, sorry.
Environment:
- PF Version: 10.0.0
- JSF + version:Mojarra 2.3.14_
- Affected browsers: ALL
To Reproduce Steps to reproduce the behavior:
will follow up
Expected behavior No console error should appear.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (15 by maintainers)
Commits related to this issue
- [MonacoEditor] fix #372, do not render monaco editor twice * Call PrimeFaces.removeDeferredRenders(this.id) on refresh so it does not invoke the deferred renderer multiple times. * Reject the pendi... — committed to blutorange/core by blutorange 3 years ago
- [MonacoEditor] fix #372, do not render monaco editor twice (#381) * Call PrimeFaces.removeDeferredRenders(this.id) on refresh so it does not invoke the deferred renderer multiple times. * Reject ... — committed to Rapster/core by blutorange 3 years ago
@blutorange You probably want to override the
destroy
andrefresh
listeners in the widget to dispose of the current editor.@blutorange : Thank you, scrollbeyondlastline indeed solved this issue.
Thanks for the reproducer, I’ll see if I can do anything to prevent the error message.
Do you mean when you set an intial value for the editor via the bean? The scrollbars look fine to me, perhaps what surprises you is that the editor can scroll past the last line as in the screenshot below? If so, that can be turned off via https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.istandaloneeditorconstructionoptions.html#scrollbeyondlastline
Or if the editor has the wrong size, you can add
autoResize=true
to have the editor resize automatically when the browser supports ResizeObserver. Otherwise you can callPF("widgetVar").layout()
to manually refresh the editor.