Socket
Socket
Sign inDemoInstall

sn-minimal-markdown-editor

Package Overview
Dependencies
1
Maintainers
5
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.7 to 1.3.8

72

Gruntfile.js

@@ -1,46 +0,46 @@

module.exports = function(grunt) {
module.exports = function (grunt) {
grunt.initConfig({
watch: {
js: {
files: ['src/**/*.js'],
tasks: ['concat:app', 'babel', 'browserify', 'concat:lib', 'concat:dist'],
options: {
spawn: false,
watch: {
js: {
files: ['src/**/*.js'],
tasks: ['concat:app', 'babel', 'browserify', 'concat:lib', 'concat:dist'],
options: {
spawn: false,
},
},
css: {
files: ['src/main.scss'],
tasks: ['sass', 'concat:css'],
options: {
spawn: false,
},
}
},
css: {
files: ['src/main.scss'],
tasks: ['sass', 'concat:css'],
options: {
spawn: false,
},
}
},
sass: {
dist: {
options: {
style: 'expanded',
sourcemap: 'none'
},
files: {
'dist/app.css': 'src/main.scss'
}
}
},
babel: {
sass: {
dist: {
options: {
sourceMap: true,
presets: ['@babel/preset-env']
style: 'expanded',
sourceMap: false
},
app: {
files: {
'dist/app.js': ['dist/app.js']
}
files: {
'dist/app.css': 'src/main.scss'
}
}
},
babel: {
options: {
sourceMap: true,
presets: ['@babel/preset-env']
},
app: {
files: {
'dist/app.js': ['dist/app.js']
}
}
},
browserify: {

@@ -69,3 +69,3 @@ dist: {

'node_modules/codemirror/lib/codemirror.js',
'node_modules/sn-components-api/dist/dist.js',
'node_modules/@standardnotes/component-relay/dist/dist.js',
'vendor/modes/markdown/markdown.js',

@@ -95,3 +95,3 @@ 'vendor/addon/modes/overlay.js',

files: [
{expand: true, cwd: 'node_modules/', src: ['sn-codemirror-search/**'], dest: 'dist/'},
{ expand: true, cwd: 'node_modules/', src: ['sn-codemirror-search/**'], dest: 'dist/' },
],

@@ -98,0 +98,0 @@ },

{
"name": "sn-minimal-markdown-editor",
"version": "1.3.7",
"version": "1.3.8",
"description": "A minimal Markdown editor for Standard Notes.",

@@ -16,2 +16,3 @@ "main": "dist/dist.js",

"@babel/preset-env": "^7.11.0",
"@standardnotes/component-relay": "2.2.0",
"babel-cli": "^6.26.0",

@@ -27,5 +28,4 @@ "codemirror": "^5.56.0",

"grunt-newer": "^1.3.0",
"sn-components-api": "1.2.8",
"sn-stylekit": "2.1.0"
}
}

@@ -1,24 +0,27 @@

document.addEventListener("DOMContentLoaded", function(event) {
document.addEventListener("DOMContentLoaded", function (event) {
var componentManager;
var workingNote, clientData;
var lastValue, lastUUID;
var editor;
var ignoreTextChange = false;
var initialLoad = true;
let componentRelay;
let workingNote, clientData;
let lastValue, lastUUID;
let editor;
let ignoreTextChange = false;
let initialLoad = true;
function loadComponentManager() {
var permissions = [{name: "stream-context-item"}]
componentManager = new ComponentManager(permissions, function(){
// on ready
var platform = componentManager.platform;
if (platform) {
document.body.classList.add(platform);
function loadComponentRelay() {
const initialPermissions = [{ name: "stream-context-item" }]
componentRelay = new ComponentRelay({
initialPermissions,
targetWindow: window,
onReady: function () {
const platform = componentRelay.platform;
if (platform) {
document.body.classList.add(platform);
}
}
// only use CodeMirror selection color if we're not on mobile.
editor.setOption("styleSelectedText", !componentManager.isMobile);
});
componentManager.streamContextItem((note) => {
// only use CodeMirror selection color if we're not on mobile.
editor.setOption("styleSelectedText", !componentRelay.isMobile);
componentRelay.streamContextItem((note) => {
onReceivedNote(note);

@@ -29,3 +32,3 @@ });

function save() {
if(workingNote) {
if (workingNote) {
// Be sure to capture this object as a variable, as this.note may be reassigned in `streamContextItem`, so by the time

@@ -36,3 +39,3 @@ // you modify it in the presave block, it may not be the same object anymore, so the presave values will not be applied to

componentManager.saveItemWithPresave(note, () => {
componentRelay.saveItemWithPresave(note, () => {
lastValue = editor.getValue();

@@ -50,3 +53,3 @@ note.content.text = lastValue;

function onReceivedNote(note) {
if(note.uuid !== lastUUID) {
if (note.uuid !== lastUUID) {
// Note changed, reset last values

@@ -61,3 +64,3 @@ lastValue = null;

// Only update UI on non-metadata updates.
if(note.isMetadataUpdate) {
if (note.isMetadataUpdate) {
return;

@@ -68,4 +71,4 @@ }

if(editor) {
if(note.content.text !== lastValue) {
if (editor) {
if (note.content.text !== lastValue) {
ignoreTextChange = true;

@@ -76,3 +79,3 @@ editor.getDoc().setValue(workingNote.content.text);

if(initialLoad) {
if (initialLoad) {
initialLoad = false;

@@ -88,8 +91,8 @@ editor.getDoc().clearHistory();

lineWrapping: true,
extraKeys: {"Alt-F": "findPersistent"}
extraKeys: { "Alt-F": "findPersistent" }
});
editor.setSize(undefined, "100%");
editor.on("change", function(){
if(ignoreTextChange) {return;}
editor.on("change", function () {
if (ignoreTextChange) { return; }
save();

@@ -100,3 +103,3 @@ });

loadEditor();
loadComponentManager();
loadComponentRelay();
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc