ng2-ace-editor icon indicating copy to clipboard operation
ng2-ace-editor copied to clipboard

Issue while trying to use XML mode

Open JSupriya10 opened this issue 6 years ago • 2 comments

Hi

I added following in package.json and angular.cli.json to add xml mode. I am using angular 5 package.json: "ng2-ace-editor": "0.3.1", "brace": "^0.11.1", "w3c-blob": "^0.0.1", "buffer": "^5.1.0", "base64-js": "^1.2.3", "ieee754": "^1.1.8" angular.cli: "../node_modules/ace-builds/src-min/ace.js", "../node_modules/ace-builds/src-min/theme-katzenmilch.js", "../node_modules/ace-builds/src-min/mode-xml.js", "../node_modules/ace-builds/src-min/worker-xml.js", "../node_modules/w3c-blob/index.js", "../node_modules/brace/index.js", "../node_modules/brace/mode/xml.js", "../node_modules/brace/worker/xml.js", "../node_modules/buffer/index.js", "../node_modules/base64-js/index.js", "../node_modules/ieee754/index.js"

The editor was set properly but not able to set the xml mode. The xml text is being displayed in single line instead of pretty xml

I am getting below error in console Uncaught ReferenceError: module is not defined at scripts.bundle.js:18 capture

scripts.bundle.js:1 Could not load worker TypeError: e.split is not a function at a.t.moduleUrl (scripts.bundle.js:1) at new f (scripts.bundle.js:1) at Mode.createWorker (webpack-internal:///../../../../brace/mode/xml.js:646) at d.$startWorker (scripts.bundle.js:1) at d.$onChangeMode (scripts.bundle.js:1) at d. (scripts.bundle.js:1) at a.t.loadModule (scripts.bundle.js:1) at d.setMode (scripts.bundle.js:1) at AceEditorDirective.setMode (webpack-internal:///../../../../ng2-ace-editor/src/directive.js:103) at AceEditorDirective.set [as mode] (webpack-internal:///../../../../ng2-ace-editor/src/directive.js:92)

Attached the screenshot of xml display. Can you please let me know what needs to be add .Also tried adding the import in the module

JSupriya10 avatar Mar 18 '18 13:03 JSupriya10

I have the same issue

console.js:35 Could not load worker TypeError: e.split is not a function
    at a.t.moduleUrl (scripts.bundle.js:1)
    at new f (scripts.bundle.js:1)
    at Mode.createWorker (json.js:292)
    at d.$startWorker (scripts.bundle.js:1)
    at d.$onChangeMode (scripts.bundle.js:1)
    at d.<anonymous> (scripts.bundle.js:1)
    at a.t.loadModule (scripts.bundle.js:1)
    at d.setMode (scripts.bundle.js:1)
    at AceEditorComponent.setMode (component.js:111)
    at AceEditorComponent.set [as mode] (component.js:100)
    at updateProp (core.js:12619)
    at checkAndUpdateDirectiveInline (core.js:12330)
    at checkAndUpdateNodeInline (core.js:13893)
    at checkAndUpdateNode (core.js:13836)
    at debugCheckAndUpdateNode (core.js:14729)
    at debugCheckDirectivesFn (core.js:14670)
    at Object.eval [as updateDirectives] (CreateUpdateConfigurationComponent.html:151)

My .angular-cli.json

 "scripts": [
        "../node_modules/ace-builds/src-min/ace.js",
        "../node_modules/ace-builds/src-min/theme-chrome.js"
      ],

My HTML

 <ace-editor
        class="config-json-editor"
        [(text)]="config"
        [theme]="'chrome'"
        [mode]="'json'"
      >
      </ace-editor>

ofirrifo avatar Mar 19 '18 09:03 ofirrifo

I am also seeing this warning, though the mode I'm using in this case is 'javascript'.

jonnypolite avatar Apr 24 '18 15:04 jonnypolite