Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cyclejs-ace-editor

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cyclejs-ace-editor - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

71

index.js

@@ -7,2 +7,4 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dom = require('@cycle/dom');

@@ -16,12 +18,6 @@

var _ace_editor_widget = require('./ace_editor_widget');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _ace_editor_widget2 = _interopRequireDefault(_ace_editor_widget);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _apply_params = require('./apply_params');
var _apply_params2 = _interopRequireDefault(_apply_params);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ace;

@@ -33,2 +29,57 @@

var AceEditorWidget = function () {
function AceEditorWidget(initialValue) {
_classCallCheck(this, AceEditorWidget);
this.type = 'Widget';
this.initialValue = initialValue;
}
_createClass(AceEditorWidget, [{
key: 'init',
value: function init() {
var el = document.createElement('pre');
el.textContent = this.initialValue;
this.editor = ace.edit(el);
return el;
}
}, {
key: 'update',
value: function update(previous, domNode) {}
}, {
key: 'destroy',
value: function destroy(domNode) {
this.editor.destroy();
this.editor.container.remove();
}
}]);
return AceEditorWidget;
}();
function applyParams(editor$, params$) {
return editor$.flatMap(function (editor) {
return params$.reduce(function (editor, config) {
var key = config[0];
var value = config[1];
switch (key) {
case 'theme':
editor.setTheme(value);
break;
case 'mode':
editor.session.setMode(value);
break;
case 'readOnly':
editor.setReadOnly(value);
break;
default:
throw new Error('Unrecognized configuration key: ' + key + ', use `editor$` sink and handle it on your own');
}
return editor;
}, editor);
});
}
function intent(_ref) {

@@ -68,3 +119,3 @@ var DOM = _ref.DOM;

(0, _apply_params2.default)(editor$, params$).subscribe();
applyParams(editor$, params$).subscribe();

@@ -90,3 +141,3 @@ var editorCode$ = editor$.map(function (editor) {

return initialValue$.take(1).map(function (code) {
return (0, _dom.div)([new _ace_editor_widget2.default(code)]);
return (0, _dom.div)([new AceEditorWidget(code)]);
});

@@ -93,0 +144,0 @@ }

2

package.json
{
"name": "cyclejs-ace-editor",
"version": "0.0.2",
"version": "0.0.3",
"description": "Cycle.js wrapper for the Ace Editor",

@@ -5,0 +5,0 @@ "main": "index.js",

import {div, pre} from '@cycle/dom'
import isolate from '@cycle/isolate'
import {ReplaySubject, Observable} from 'rx'
import AceEditorWidget from './ace_editor_widget'
import applyParams from './apply_params'

@@ -13,2 +11,52 @@ var ace

class AceEditorWidget {
constructor(initialValue) {
this.type = 'Widget'
this.initialValue = initialValue
}
init() {
const el = document.createElement('pre')
el.textContent = this.initialValue
this.editor = ace.edit(el)
return el
}
update(previous, domNode) {
}
destroy(domNode) {
this.editor.destroy()
this.editor.container.remove()
}
}
function applyParams(editor$, params$) {
return editor$
.flatMap(editor => {
return params$.reduce((editor, config) => {
const key = config[0]
const value = config[1]
switch(key) {
case 'theme':
editor.setTheme(value)
break
case 'mode':
editor.session.setMode(value)
break
case 'readOnly':
editor.setReadOnly(value)
break
default:
throw new Error('Unrecognized configuration key: ' + key + ', use `editor$` sink and handle it on your own')
}
return editor
}, editor)
})
}
function intent({DOM, params$, initialValue$}) {

@@ -15,0 +63,0 @@ const editor$ = DOM.select('.ace_editor')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc