diff --git a/sources/raje/app/css/rash-inline.css b/sources/raje/app/css/rash-inline.css
index c3c32e5..0d27967 100644
--- a/sources/raje/app/css/rash-inline.css
+++ b/sources/raje/app/css/rash-inline.css
@@ -97,7 +97,7 @@ img.avatar{
span.affiliation.placeholder{
color:#999
}
-
+/*
pre{
position: relative
}
@@ -109,4 +109,8 @@ pre::after{
padding: 10px 20px;
background-color: rgba('0,0,0,.5');
content: "enter = new line"
-}
\ No newline at end of file
+}
+
+figure > pref::after{
+ display: none
+}*/
\ No newline at end of file
diff --git a/sources/raje/app/js/editor/1_init.js b/sources/raje/app/js/editor/1_init.js
index ba03ce4..d7a0652 100644
--- a/sources/raje/app/js/editor/1_init.js
+++ b/sources/raje/app/js/editor/1_init.js
@@ -63,6 +63,11 @@ jQuery.fn.extend({
setEditState()
})
+ $(this).bind('dragover drop', function (event) {
+ event.preventDefault();
+ return false;
+ });
+
/**
* Get when call event to disable or activate toolbar elements
*/
@@ -180,6 +185,12 @@ window.handleFormulaBox = function () {
window[id].showModal();
};
+window.handleListingBox = function () {
+ var id = 'table_' + ($(this).findNumber(listingbox_selector) + 1);
+ window[id] = new rashEditor.Listing(id);
+ window[id].add();
+};
+
$(document).ready(function () {
/* START .rash_inline */
diff --git a/sources/raje/app/js/editor/2_caret.js b/sources/raje/app/js/editor/2_caret.js
index 014e3a1..db10617 100644
--- a/sources/raje/app/js/editor/2_caret.js
+++ b/sources/raje/app/js/editor/2_caret.js
@@ -26,7 +26,7 @@ caret = {
},
checkIfInHeading: function () {
- return $(window.getSelection().anchorNode).parents('h1,h2,h3').length;
+ return $(window.getSelection().anchorNode).parents('h1,h2,h3,h4,h5,h6').length;
},
checkIfBorder: function () {
diff --git a/sources/raje/app/js/editor/3_const.js b/sources/raje/app/js/editor/3_const.js
index c80fd0b..0d6de61 100644
--- a/sources/raje/app/js/editor/3_const.js
+++ b/sources/raje/app/js/editor/3_const.js
@@ -14,3 +14,14 @@ const ZERO_SPACE = '';
const ONE_SPACE = ' ';
const messageDealer = 'div#messageDealer';
+
+Array.prototype.indexOfContent = function (searchTerm) {
+ let index = -1;
+ for (var i = 0, len = this.length; i < len; i++) {
+ if (this[i].content == searchTerm) {
+ index = i;
+ break;
+ }
+ }
+ return index
+}
diff --git a/sources/raje/app/js/editor/4_raje.js b/sources/raje/app/js/editor/4_raje.js
index be620f5..37b23c4 100644
--- a/sources/raje/app/js/editor/4_raje.js
+++ b/sources/raje/app/js/editor/4_raje.js
@@ -173,8 +173,11 @@ rashEditor = {
let title = $(sel.anchorNode).parents('h1')
- if (!$('h1.title small').length)
- document.execCommand("insertHTML", false, `
${ZERO_SPACE}`)
+ if (!title.find('small').length) {
+ title.append(`
${ZERO_SPACE}`)
+ caret.moveStart(title.find('small'))
+ caret.move('character', 1)
+ }
}
},
@@ -331,6 +334,18 @@ rashEditor = {
referenceables.append(formulas)
}
+ if ($(`${rash_inline_selector} ${listingbox_selector}`).length) {
+
+ let formulas = $(this.createCollapsable('Listings'))
+
+ $(`${rash_inline_selector} figure:has(pre)`).each(function () {
+ let text = $(this).find('figcaption').text()
+ formulas.find('#listListings').append(`${text}`)
+ })
+
+ referenceables.append(formulas)
+ }
+
let references = $(this.createCollapsable('References'))
references.find('#listReferences').append(`+ add new bibliographic reference`)
@@ -384,11 +399,14 @@ rashEditor = {
if (sel.isCollapsed) {
document.execCommand("insertHTML", false, string);
caret.moveStart($(`${element}[data-pointer]`))
- $(`${element}[data-pointer]`).removeAttr('data-pointer')
+
+ caret.move('character', 1)
if (isFormula) {
caret.move('character', 2)
}
+
+ $(`${element}[data-pointer]`).removeAttr('data-pointer')
}
else {
var range = sel.getRangeAt(0);
@@ -659,8 +677,13 @@ rashEditor = {
} else {
- if (!node)
- node = $('section[role="doc-endnotes"]>section:last-child')
+ if (!node) {
+ if ($('section[role="doc-endnotes"]>section').length)
+ node = $('section[role="doc-endnotes"]>section:last-child')
+ else
+ node = $('section[role="doc-endnotes"]>h1')
+ }
+
let getNextEndnote = function () {
let max = -1
@@ -899,8 +922,19 @@ rashEditor = {
if (undefined !== this.selection) {
rangy.restoreSelection(this.selection);
+ let paragraph = $(rangy.getSelection().anchorNode).parents('p').first()
+
+ let string
+
+ if (paragraph.text().length != 0) {
+ string = `
${mathml}
`) }) + // Formula inline + body.find('span[data-formula]:has(span[data-mathml])').each(function () { + let mathml = $(this).find('span[data-mathml]').data('mathml') + $(this).html(`${mathml}`) + }) + body.find('tbody').each(function () { }) /** End sections */ diff --git a/sources/raje/app/js/raje.js b/sources/raje/app/js/raje.js index fae8852..81f090d 100644 --- a/sources/raje/app/js/raje.js +++ b/sources/raje/app/js/raje.js @@ -63,6 +63,11 @@ jQuery.fn.extend({ setEditState() }) + $(this).bind('dragover drop', function (event) { + event.preventDefault(); + return false; + }); + /** * Get when call event to disable or activate toolbar elements */ @@ -180,6 +185,12 @@ window.handleFormulaBox = function () { window[id].showModal(); }; +window.handleListingBox = function () { + var id = 'table_' + ($(this).findNumber(listingbox_selector) + 1); + window[id] = new rashEditor.Listing(id); + window[id].add(); +}; + $(document).ready(function () { /* START .rash_inline */ @@ -331,7 +342,7 @@ caret = { }, checkIfInHeading: function () { - return $(window.getSelection().anchorNode).parents('h1,h2,h3').length; + return $(window.getSelection().anchorNode).parents('h1,h2,h3,h4,h5,h6').length; }, checkIfBorder: function () { @@ -526,6 +537,17 @@ const ONE_SPACE = ' '; const messageDealer = 'div#messageDealer'; +Array.prototype.indexOfContent = function (searchTerm) { + let index = -1; + for (var i = 0, len = this.length; i < len; i++) { + if (this[i].content == searchTerm) { + index = i; + break; + } + } + return index +} + rashEditor = { /* und/redo */ @@ -701,8 +723,11 @@ rashEditor = { let title = $(sel.anchorNode).parents('h1') - if (!$('h1.title small').length) - document.execCommand("insertHTML", false, `${mathml}
`) }) + // Formula inline + body.find('span[data-formula]:has(span[data-mathml])').each(function () { + let mathml = $(this).find('span[data-mathml]').data('mathml') + $(this).html(`${mathml}`) + }) + body.find('tbody').each(function () { }) /** End sections */ diff --git a/sources/raje/app/main.js b/sources/raje/app/main.js index 0006c82..d39e74f 100644 --- a/sources/raje/app/main.js +++ b/sources/raje/app/main.js @@ -54,9 +54,9 @@ function createWindow() { setSplashMenu() - fs.createReadStream('js/raje.js').pipe(fs.createWriteStream(`/Users/spino93/Desktop/prova/js/raje.js`)) + //fs.createReadStream('js/raje.js').pipe(fs.createWriteStream(`/Users/spino93/Desktop/test/js/raje.js`)) //fs.createReadStream('js/rash.js').pipe(fs.createWriteStream(`/Users/spino93/Desktop/dummylol/js/rash.js`)) - //fs.createReadStream('css/rash-inline.css').pipe(fs.createWriteStream(`/Users/spino93/Desktop/prova/css/rash-inline.css`)) + //fs.createReadStream('css/rash-inline.css').pipe(fs.createWriteStream(`/Users/spino93/Desktop/test/css/rash-inline.css`)) //fs.createReadStream('css/rash.css').pipe(fs.createWriteStream(`/Users/spino93/Desktop/spinaci-rajedoc2016/css/rash.css`)) mainWindow.on('close', (event) => { @@ -551,8 +551,11 @@ function setEditorMenu() { if (err) throw err let template = [menuUtils.File, menuUtils.Edit, menuUtils.RASH, menu, menuUtils.Help] - if (process.platform === 'darwin') + if (process.platform === 'darwin') { + systemPreferences.setUserDefault('NSDisabledDictationMenuItem', 'boolean', true) + systemPreferences.setUserDefault('NSDisabledCharacterPaletteMenuItem', 'boolean', true) template.unshift(menuUtils.MacOSX) + } updateMenu(template) }) @@ -583,9 +586,6 @@ function chooseGithub(callback) { }) } -systemPreferences.setUserDefault('NSDisabledDictationMenuItem', 'boolean', true) -systemPreferences.setUserDefault('NSDisabledCharacterPaletteMenuItem', 'boolean', true) - const menuUtils = { File: { label: 'File', @@ -638,26 +638,6 @@ const menuUtils = { }, { type: 'separator' - }, - { - label: 'Insert Title', - click() { } - }, - { - label: 'Insert Author', - click() { mainWindow.webContents.send('addNewAuthor') } - }, - { - label: 'Insert ACM Subject Category', - click() { - mainWindow.webContents.send('insertSubject') - } - }, - { - label: 'Insert Keyword', - click() { - mainWindow.webContents.send('insertKeyword') - } } ] }, @@ -682,8 +662,35 @@ const menuUtils = { type: 'separator' }, { - label: 'Show Rawgit', - enabled: false + label: 'Insert Title', + click() { } + }, + { + label: 'Insert Author', + click() { mainWindow.webContents.send('addNewAuthor') } + }, + { + label: 'Insert ACM Subject Category', + click() { + mainWindow.webContents.send('insertSubject') + } + }, + { + label: 'Insert Keyword', + click() { + mainWindow.webContents.send('insertKeyword') + } + }, + { + label: 'Toggle Change Authors Position', + click() { + if (reorganizingAuthors) + mainWindow.webContents.send('unsetReorganizeAuthors') + else + mainWindow.webContents.send('setReorganizeAuthors') + + reorganizingAuthors = !reorganizingAuthors + } }, { type: 'separator' diff --git a/sources/raje/app/main/splash.js b/sources/raje/app/main/splash.js index 9be59db..dbd7171 100644 --- a/sources/raje/app/main/splash.js +++ b/sources/raje/app/main/splash.js @@ -13,6 +13,9 @@ module.exports = { * */ initFolder: function (mainWindow, settings) { + settings.title = settings.title.replace(/\s\s+/g, ' ') + settings.title = settings.title.replace(' ', '_') + let folderPath = `${settings.path}/${settings.title}` let articlePath = `${folderPath}/${settings.title}.html` let toSaveSettings = { @@ -74,6 +77,7 @@ module.exports = { openEditorWindow: function (mainWindow, articlePath, title) { mainWindow.loadURL(`file://${articlePath}`) mainWindow.maximize() + //mainWindow.webContents.toggleDevTools() if (title) mainWindow.webContents.send('updateTitle', title) }, diff --git a/sources/raje/app/splash.html b/sources/raje/app/splash.html index 31ddad2..2aa1031 100644 --- a/sources/raje/app/splash.html +++ b/sources/raje/app/splash.html @@ -41,7 +41,7 @@