Giter Club home page Giter Club logo

ember-monaco's Introduction

ember-monaco

Monaco editor for ember.js apps

Build Status Version

Installation

ember install ember-monaco

Usage

controllers/application.ts
import Controller from '@ember/controller';

export default class Application extends Controller {
  sample1 = "let x: string = 'foo'";

  @action
  editorReady (editor) {
    // editor: Monaco editor instance
  }
}
templates/application.hbs
{{code-editor
  language="typescript"
  code=sample1
  onChange=(action (mut sample1))
  theme="light"
  onReady=(action editorReady)
}}

Additional options:

To create a read-only editor, pass readOnly=true to the code-editor component. readOnly defaults to false.

Contributing

Installation

  • git clone <repository-url>
  • cd ember-monaco
  • yarn install

Linting

  • yarn lint:hbs
  • yarn lint:js
  • yarn lint:js --fix

Running tests

  • ember test – Runs the test suite on the current Ember version
  • ember test --server – Runs the test suite in "watch mode"
  • ember try:each – Runs the test suite against multiple Ember versions

Running the dummy application

For more information on using ember-cli, visit https://ember-cli.com/.

License

This project is licensed under the BSD-2-Clause.

Thanks

Thanks to @MiguelMadero for writing ember-monaco-editor, which served as a starting point for this work

ember-monaco's People

Contributors

renovate-bot avatar mike-north avatar semantic-release-bot avatar jenweber avatar abhishek97 avatar spencer516 avatar ember-tomster avatar

Stargazers

Tobie Morgan Hitchcock avatar Ryan Baxter avatar Justin Workman avatar Michael Spears avatar  avatar KM Koushik avatar Nelson Páez avatar Rajasegar Chandran avatar Rajasegar Chandran avatar Sébastien Garagnani avatar Keita Urashima avatar Damien Bachet avatar  avatar Peter Meehan avatar Thomas Eilmsteiner avatar Denys Slipetskyy avatar Tom Meiselbach avatar Dawid Pośliński avatar

Watchers

 avatar  avatar

ember-monaco's Issues

Incompatibility with yarn workspaces

Trying to pull the package into a yarn workspace'd Ember application (latest version) and I get the following error:

Attempting to watch missing directory: node_modules/monaco-editor/dev/vs

I can get around this error by installing monaco-editor as a direct dependency in my app and using nohoist to get it to build at the nested node_modules level. I run into a similar error, however, for regenerator-runtime.

I have a working branch that gets around this by resolving the package paths by stepping up the parent tree. I can push that up if that sounds like it would fix it!

Example:

    const regeneratorPath = require.resolve('regenerator-runtime')
      .split('/')
      .slice(0, -1)
      .join('/');

    const regeneratorTree = maybeDebug(
      new Funnel(regeneratorPath, {
        destDir: '.'
      }),
      '1.1-regenerator-src'
    );

How to access the Monaco instance to add custom languages?

Hi,

Is it possible to access the Monaco instance (not the editor instance) to add custom language/intellisense support?

I thought about modifying the onReady callback to provide both the editor and monaco instances from the iframe, but it seems to me this should really be done in an initializer before any editor components are initialized, not as a callback on individual editors. But I'm not sure how to accomplish that without access to the global.

Any ideas? Thanks!

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (@mike-north/js-lib-renovate-config)

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Found Unknown Transformation `cjs`

After installing ember-monaco into a brand-new ember project (ember-cli version 3.7.1), I get this error when running ember s:

> ember s
while import node_modules/penpal/lib/index.js: found an unknown transformation name cjs. Available transformNames are: amd

This can be resolved by installing/adding ember-cli-cjs-transform to my app's devDependencies. I'll open a PR with a potential solution — but not really sure if this is an ember-monaco issue, or an ember-cli issue?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @types/ember-qunit Unavailable
npm @types/ember__test-helpers Unavailable
npm ember-ajax Unavailable
npm ember-cli-eslint Unavailable
npm ember-cli-htmlbars-inline-precompile Unavailable
npm ember-cli-template-lint Unavailable
npm ember-cli-uglify Unavailable
npm eslint-plugin-node Available
npm rollup-plugin-babel Available
npm rollup-plugin-commonjs Unavailable
npm rollup-plugin-node-resolve Available
npm typescript-eslint-parser Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): rollup-plugin-babel
  • fix(deps): rollup-plugin-node-resolve
  • chore(deps): ambient types (patch) (@types/ember-test-helpers, @types/ember-testing-helpers, @types/rsvp)
  • chore(deps): commitlint monorepo (patch) (@commitlint/cli, @commitlint/config-conventional, @commitlint/travis-cli)
  • chore(deps): ember-ajax
  • chore(deps): ember-cli-template-lint
  • chore(deps): eslint-plugin-ember
  • chore(deps): ember-try
  • chore(deps): husky
  • chore(deps): stable ember infrastructure (minor) (ember-cli, ember-cli-dependency-checker, ember-resolver, ember-source, eslint-plugin-ember, eslint-plugin-node)
  • chore(deps): typescript
  • fix(deps): monaco-editor
  • chore(deps): ember-cli-template-lint
  • chore(deps): ember-try
  • chore(deps): husky
  • chore(deps): stable ember infrastructure (major) (ember-cli, ember-cli-babel, ember-qunit, ember-resolver, ember-source, eslint-plugin-ember, qunit-dom)
  • chore(deps): typescript-eslint-parser
  • fix(deps): broccoli-typescript-compiler
  • fix(deps): ember-cli-typescript
  • chore: lockfile maintenance
  • 🔐 Create all rate-limited PRs at once 🔐

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • @babel/preset-env ^7.2.3
  • broccoli-rollup ^2.1.1
  • broccoli-typescript-compiler ^4.1.0
  • ember-cli-babel ^7.0.0
  • ember-cli-cjs-transform ^1.3.0
  • ember-cli-htmlbars ^6.0.0
  • ember-cli-typescript ^2.0.0-rc.1
  • monaco-editor ^0.16.0
  • penpal ^3.0.7
  • rollup-plugin-babel ^4.2.0
  • rollup-plugin-commonjs ^9.2.0
  • rollup-plugin-node-resolve ^4.0.0
  • @commitlint/cli 8.3.5
  • @commitlint/config-conventional 8.3.4
  • @commitlint/travis-cli 8.3.5
  • @ember/optional-features 0.7.0
  • @mike-north/js-lib-renovate-config 1.3.1
  • @mike-north/js-lib-semantic-release-config 1.0.1
  • @types/ember 3.1.2
  • @types/ember-qunit 3.4.15
  • @types/ember-test-helpers 1.0.10
  • @types/ember-testing-helpers 0.0.4
  • @types/ember__test-helpers 0.7.12
  • @types/qunit 2.9.6
  • @types/rsvp 4.0.4
  • broccoli-asset-rev 3.0.0
  • ember-ajax 5.1.1
  • ember-cli 3.27.0
  • ember-cli-dependency-checker 3.2.0
  • ember-cli-eslint 5.1.0
  • ember-cli-htmlbars-inline-precompile 3.0.2
  • ember-cli-inject-live-reload 2.1.0
  • ember-cli-sri 2.1.1
  • ember-cli-template-lint 1.0.0-beta.3
  • ember-cli-typescript-blueprints 2.0.0
  • ember-cli-uglify 3.0.0
  • ember-disable-prototype-extensions 1.1.3
  • ember-export-application-global 2.0.1
  • ember-load-initializers 2.1.2
  • ember-maybe-import-regenerator 0.1.6
  • ember-qunit 5.1.5
  • ember-resolver 8.0.3
  • ember-source 4.0.1
  • ember-source-channel-url 2.0.1
  • ember-try 1.2.1
  • eslint-plugin-ember 10.5.8
  • eslint-plugin-node 11.1.0
  • husky 2.4.1
  • loader.js 4.7.0
  • qunit-dom 2.0.0
  • semantic-release 15.13.12
  • typescript 3.2.4
  • typescript-eslint-parser 21.0.2
  • node 6.* || 8.* || >= 10.*
travis
.travis.yml
  • node 8

  • Check this box to trigger a request for Renovate to run again on this repository

How to get the editor instance ?

I see that current the only way to get the editor instance is to get editor property on iframe's contentWindow. Is there a better way ?, like a onReady action to passed on as an argument to the component?

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Build times too high

I've noticed that by adding this package, the build times increase significantly. I think it is due to building all the js files for Monaco. Using prebuilt version of monaco might make more sense. @mike-north any ideas how should i go about fixing this?

Can't build for production with sourcemaps enabled

I cannot build an ember app for production if i enable sourcemaps

let app = new EmberApp(defaults, {
    // Add options here
    sourcemaps: {
      enabled: true,
      extensions: ['js']
    },
}

Error:

Circular dependency: ../../../../private/var/folders/5g/t2x1c1gj70x2zhgfhfwyzzh40000gn/T/broccoli-453285N7yqGAz5n1W/cache-104-rollup/build/editor-scripts/conn.js -> ../../../../private/var/folders/5g/t2x1c1gj70x2zhgfhfwyzzh40000gn/T/broccoli-453285N7yqGAz5n1W/cache-104-rollup/build/editor-scripts/editor.js -> ../../../../private/var/folders/5g/t2x1c1gj70x2zhgfhfwyzzh40000gn/T/broccoli-453285N7yqGAz5n1W/cache-104-rollup/build/editor-scripts/conn.js
[WARN] (broccoli-uglify-sourcemap) "../../../../min-maps/vs/base/worker/workerMain.js.map" referenced in "ember-monaco/vs/base/worker/workerMain.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.js.map" referenced in "ember-monaco/vs/editor/editor.main.js" could not be found
[WARN] (broccoli-uglify-sourcemap) Minifying "ember-monaco/vs/base/worker/workerMain.js" took: 20638ms (more than 20,000ms)
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.de.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.de.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.es.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.es.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.fr.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.fr.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.it.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.it.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.ja.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.ja.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.ko.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.ko.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.ru.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.ru.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.zh-cn.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.zh-cn.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.zh-tw.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.zh-tw.js" could not be found
[WARN] (broccoli-uglify-sourcemap) Minifying "assets/vendor.js" took: 75230ms (more than 20,000ms)
[WARN] (broccoli-uglify-sourcemap) Minifying "ember-monaco/vs/editor/editor.main.js" took: 71011ms (more than 20,000ms)
Build Error (UglifyWriter)

EISDIR: illegal operation on a directory, read

It can reproduced on a new ember app. For now, just excluding it from uglify works.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.