mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge branch 'master' into ja-per-user-track-changes
This commit is contained in:
commit
fbce49f5cd
18 changed files with 1667 additions and 136 deletions
|
@ -293,6 +293,7 @@ module.exports = ProjectController =
|
|||
theme : user.ace.theme
|
||||
fontSize : user.ace.fontSize
|
||||
autoComplete: user.ace.autoComplete
|
||||
autoPairDelimiters: user.ace.autoPairDelimiters
|
||||
pdfViewer : user.ace.pdfViewer
|
||||
syntaxValidation: user.ace.syntaxValidation
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ SubscriptionGroupController = require './SubscriptionGroupController'
|
|||
Settings = require "settings-sharelatex"
|
||||
|
||||
module.exports =
|
||||
apply: (webRouter, apiRouter) ->
|
||||
apply: (webRouter, privateApiRouter, publicApiRouter) ->
|
||||
return unless Settings.enableSubscriptions
|
||||
|
||||
webRouter.get '/user/subscription/plans', SubscriptionController.plansPage
|
||||
|
@ -35,7 +35,7 @@ module.exports =
|
|||
webRouter.get '/user/subscription/:subscription_id/group/successful-join', AuthenticationController.requireLogin(), SubscriptionGroupController.renderSuccessfulJoinPage
|
||||
|
||||
#recurly callback
|
||||
apiRouter.post '/user/subscription/callback', SubscriptionController.recurlyNotificationParser, SubscriptionController.recurlyCallback
|
||||
publicApiRouter.post '/user/subscription/callback', SubscriptionController.recurlyNotificationParser, SubscriptionController.recurlyCallback
|
||||
|
||||
#user changes their account state
|
||||
webRouter.post '/user/subscription/create', AuthenticationController.requireLogin(), SubscriptionController.createSubscription
|
||||
|
|
|
@ -74,6 +74,8 @@ module.exports = UserController =
|
|||
user.ace.fontSize = req.body.fontSize
|
||||
if req.body.autoComplete?
|
||||
user.ace.autoComplete = req.body.autoComplete
|
||||
if req.body.autoPairDelimiters?
|
||||
user.ace.autoPairDelimiters = req.body.autoPairDelimiters
|
||||
if req.body.spellCheckLanguage?
|
||||
user.ace.spellCheckLanguage = req.body.spellCheckLanguage
|
||||
if req.body.pdfViewer?
|
||||
|
|
|
@ -24,6 +24,7 @@ UserSchema = new Schema
|
|||
theme : {type : String, default: 'textmate'}
|
||||
fontSize : {type : Number, default:'12'}
|
||||
autoComplete: {type : Boolean, default: true}
|
||||
autoPairDelimiters: {type : Boolean, default: true}
|
||||
spellCheckLanguage : {type : String, default: "en"}
|
||||
pdfViewer : {type : String, default: "pdfjs"}
|
||||
syntaxValidation : {type : Boolean}
|
||||
|
|
|
@ -69,7 +69,7 @@ module.exports = class Router
|
|||
|
||||
EditorRouter.apply(webRouter, privateApiRouter)
|
||||
CollaboratorsRouter.apply(webRouter, privateApiRouter)
|
||||
SubscriptionRouter.apply(webRouter, privateApiRouter)
|
||||
SubscriptionRouter.apply(webRouter, privateApiRouter, publicApiRouter)
|
||||
UploadsRouter.apply(webRouter, privateApiRouter)
|
||||
PasswordResetRouter.apply(webRouter, privateApiRouter)
|
||||
StaticPagesRouter.apply(webRouter, privateApiRouter)
|
||||
|
@ -94,7 +94,14 @@ module.exports = class Router
|
|||
SudoModeMiddlewear.protectPage,
|
||||
UserPagesController.settingsPage
|
||||
webRouter.post '/user/settings', AuthenticationController.requireLogin(), UserController.updateUserSettings
|
||||
webRouter.post '/user/password/update', AuthenticationController.requireLogin(), UserController.changePassword
|
||||
webRouter.post '/user/password/update',
|
||||
AuthenticationController.requireLogin(),
|
||||
RateLimiterMiddlewear.rateLimit({
|
||||
endpointName: "change-password"
|
||||
maxRequests: 10
|
||||
timeInterval: 60
|
||||
}),
|
||||
UserController.changePassword
|
||||
|
||||
webRouter.get '/user/sessions',
|
||||
AuthenticationController.requireLogin(),
|
||||
|
|
|
@ -37,6 +37,7 @@ div.full-size(
|
|||
keybindings="settings.mode",
|
||||
font-size="settings.fontSize",
|
||||
auto-complete="settings.autoComplete",
|
||||
auto-pair-delimiters="settings.autoPairDelimiters",
|
||||
spell-check="!anonymous",
|
||||
spell-check-language="project.spellCheckLanguage"
|
||||
highlights="onlineUserCursorHighlights[editor.open_doc_id]"
|
||||
|
|
|
@ -105,6 +105,14 @@ aside#left-menu.full-size(
|
|||
ng-options="o.v as o.n for o in [{ n: 'On', v: true }, { n: 'Off', v: false }]"
|
||||
)
|
||||
|
||||
.form-controls
|
||||
label(for="autoPairDelimiters") #{translate("auto_close_brackets")}
|
||||
select(
|
||||
name="autoPairDelimiters"
|
||||
ng-model="settings.autoPairDelimiters"
|
||||
ng-options="o.v as o.n for o in [{ n: 'On', v: true }, { n: 'Off', v: false }]"
|
||||
)
|
||||
|
||||
.form-controls.code-check-setting
|
||||
label(for="syntaxValidation") #{translate("syntax_validation")}
|
||||
select(
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
li
|
||||
h2 #{translate("folders")}
|
||||
li.tag(
|
||||
ng-repeat="tag in tags | orderBy:name",
|
||||
ng-repeat="tag in tags | orderBy:'name'",
|
||||
ng-class="{active: tag.selected}",
|
||||
ng-cloak,
|
||||
ng-click="selectTag(tag)"
|
||||
|
|
|
@ -72,6 +72,8 @@
|
|||
// whitelistUrls: ['example.com/scripts/']
|
||||
}).install();
|
||||
}
|
||||
}, function(err) {
|
||||
console.log(">> error loading raven", err);
|
||||
})
|
||||
- if (user && typeof(user) != "undefined" && typeof (user.email) != "undefined")
|
||||
script(type="text/javascript").
|
||||
|
|
1020
services/web/npm-shrinkwrap.json
generated
1020
services/web/npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load diff
|
@ -30,8 +30,8 @@
|
|||
"ioredis": "^2.4.0",
|
||||
"jade": "~1.3.1",
|
||||
"ldapjs": "^0.7.1",
|
||||
"logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#master",
|
||||
"lodash": "^4.13.1",
|
||||
"logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#master",
|
||||
"lynx": "0.1.1",
|
||||
"marked": "^0.3.5",
|
||||
"method-override": "^2.3.3",
|
||||
|
@ -39,7 +39,7 @@
|
|||
"mimelib": "0.2.14",
|
||||
"mocha": "1.17.1",
|
||||
"mongojs": "2.4.0",
|
||||
"mongoose": "4.1.0",
|
||||
"mongoose": "4.11.4",
|
||||
"multer": "^0.1.8",
|
||||
"nodemailer": "2.1.0",
|
||||
"nodemailer-sendgrid-transport": "^0.2.0",
|
||||
|
@ -48,23 +48,23 @@
|
|||
"passport": "^0.3.2",
|
||||
"passport-ldapauth": "^0.6.0",
|
||||
"passport-local": "^1.0.0",
|
||||
"passport-saml": "^0.15.0",
|
||||
"pug": "^2.0.0-beta6",
|
||||
"redis": "0.10.1",
|
||||
"redis-sharelatex": "git+https://github.com/sharelatex/redis-sharelatex.git#v1.0.2",
|
||||
"request": "^2.69.0",
|
||||
"requests": "^0.1.7",
|
||||
"rimraf": "2.2.6",
|
||||
"rolling-rate-limiter": "git+https://github.com/ShaneKilkelly/rolling-rate-limiter.git#master",
|
||||
"sanitizer": "0.1.1",
|
||||
"sequelize": "^3.2.0",
|
||||
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0",
|
||||
"sixpack-client": "^1.0.0",
|
||||
"temp": "^0.8.3",
|
||||
"underscore": "1.6.0",
|
||||
"v8-profiler": "^5.2.3",
|
||||
"xml2js": "0.2.0",
|
||||
"passport-saml": "^0.15.0",
|
||||
"pug": "^2.0.0-beta6",
|
||||
"uuid": "^3.0.1",
|
||||
"rolling-rate-limiter": "git+https://github.com/ShaneKilkelly/rolling-rate-limiter.git#master"
|
||||
"v8-profiler": "^5.2.3",
|
||||
"xml2js": "0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.6.1",
|
||||
|
|
|
@ -44,6 +44,7 @@ define [
|
|||
keybindings: "="
|
||||
fontSize: "="
|
||||
autoComplete: "="
|
||||
autoPairDelimiters: "="
|
||||
sharejsDoc: "="
|
||||
spellCheck: "="
|
||||
spellCheckLanguage: "="
|
||||
|
@ -78,10 +79,16 @@ define [
|
|||
editor = ace.edit(element.find(".ace-editor-body")[0])
|
||||
editor.$blockScrolling = Infinity
|
||||
|
||||
# disable auto insertion of brackets and quotes
|
||||
editor.setOption('behavioursEnabled', false)
|
||||
# auto-insertion of braces, brackets, dollars
|
||||
editor.setOption('behavioursEnabled', scope.autoPairDelimiters || false)
|
||||
editor.setOption('wrapBehavioursEnabled', false)
|
||||
|
||||
scope.$watch "autoPairDelimiters", (autoPairDelimiters) =>
|
||||
if autoPairDelimiters
|
||||
editor.setOption('behavioursEnabled', true)
|
||||
else
|
||||
editor.setOption('behavioursEnabled', false)
|
||||
|
||||
window.editors ||= []
|
||||
window.editors.push editor
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ define [
|
|||
"ace/ext-language_tools"
|
||||
], (SuggestionManager, SnippetManager) ->
|
||||
Range = ace.require("ace/range").Range
|
||||
aceSnippetManager = ace.require('ace/snippets').snippetManager
|
||||
|
||||
getLastCommandFragment = (lineUpToCursor) ->
|
||||
if m = lineUpToCursor.match(/(\\[^\\]+)$/)
|
||||
|
@ -12,6 +13,9 @@ define [
|
|||
else
|
||||
return null
|
||||
|
||||
getCommandNameFromFragment = (commandFragment) ->
|
||||
commandFragment?.match(/\\(\w+)\{/)?[1]
|
||||
|
||||
class AutoCompleteManager
|
||||
constructor: (@$scope, @editor, @element, @labelsManager) ->
|
||||
@suggestionManager = new SuggestionManager()
|
||||
|
@ -59,14 +63,14 @@ define [
|
|||
caption: "\\#{commandName}{}",
|
||||
snippet: "\\#{commandName}{}",
|
||||
meta: "cross-reference",
|
||||
score: 11000
|
||||
score: 60
|
||||
}
|
||||
for label in labelsManager.getAllLabels()
|
||||
result.push {
|
||||
caption: "\\#{commandName}{#{label}#{if needsClosingBrace then '}' else ''}",
|
||||
value: "\\#{commandName}{#{label}#{if needsClosingBrace then '}' else ''}",
|
||||
meta: "cross-reference",
|
||||
score: 10000
|
||||
score: 50
|
||||
}
|
||||
callback null, result
|
||||
|
||||
|
@ -93,7 +97,7 @@ define [
|
|||
caption: "\\#{commandName}{}",
|
||||
snippet: "\\#{commandName}{}",
|
||||
meta: "reference",
|
||||
score: 11000
|
||||
score: 60
|
||||
}
|
||||
if references.keys and references.keys.length > 0
|
||||
references.keys.forEach (key) ->
|
||||
|
@ -102,7 +106,7 @@ define [
|
|||
caption: "\\#{commandName}{#{previousArgsCaption}#{key}#{if needsClosingBrace then '}' else ''}",
|
||||
value: "\\#{commandName}{#{previousArgs}#{key}#{if needsClosingBrace then '}' else ''}",
|
||||
meta: "reference",
|
||||
score: 10000
|
||||
score: 50
|
||||
})
|
||||
callback null, result
|
||||
else
|
||||
|
@ -121,7 +125,18 @@ define [
|
|||
end = change.end
|
||||
range = new Range(end.row, 0, end.row, end.column)
|
||||
lineUpToCursor = @editor.getSession().getTextRange(range)
|
||||
if lineUpToCursor.match(/.*%.*/)
|
||||
return
|
||||
lastCharIsBackslash = lineUpToCursor.slice(-1) == "\\"
|
||||
lastTwoChars = lineUpToCursor.slice(-2)
|
||||
# Don't offer autocomplete on double-backslash, backslash-colon, etc
|
||||
if lastTwoChars.match(/^\\[^a-z]$/)
|
||||
@editor?.completer?.detach?()
|
||||
return
|
||||
commandFragment = getLastCommandFragment(lineUpToCursor)
|
||||
commandName = getCommandNameFromFragment(commandFragment)
|
||||
if commandName in ['begin', 'end']
|
||||
return
|
||||
# Check that this change was made by us, not a collaborator
|
||||
# (Cursor is still one place behind)
|
||||
# NOTE: this is also the case when a user backspaces over a highlighted region
|
||||
|
@ -130,7 +145,7 @@ define [
|
|||
end.row == cursorPosition.row and
|
||||
end.column == cursorPosition.column + 1
|
||||
)
|
||||
if commandFragment? and commandFragment.length > 2
|
||||
if (commandFragment? and commandFragment.length > 2) or lastCharIsBackslash
|
||||
setTimeout () =>
|
||||
@editor.execCommand("startAutocomplete")
|
||||
, 0
|
||||
|
@ -154,6 +169,70 @@ define [
|
|||
if this.completions.filterText.match(/^\\begin\{/) and nextChar == "}"
|
||||
editor.session.remove(range)
|
||||
|
||||
# Provide our own `insertMatch` implementation.
|
||||
# See the `insertMatch` method of Autocomplete in `ext-language_tools.js`.
|
||||
# We need this to account for editing existing commands, particularly when
|
||||
# adding a prefix.
|
||||
# We fix this by detecting when the cursor is in the middle of an existing
|
||||
# command, and adjusting the insertions/deletions accordingly.
|
||||
# Example:
|
||||
# when changing `\ref{}` to `\href{}`, ace default behaviour
|
||||
# is likely to end up with `\href{}ref{}`
|
||||
if !data?
|
||||
completions = this.completions
|
||||
popup = editor.completer.popup
|
||||
data = popup.getData(popup.getRow())
|
||||
data.completer =
|
||||
insertMatch: (editor, matchData) ->
|
||||
for range in editor.selection.getAllRanges()
|
||||
leftRange = _.clone(range)
|
||||
rightRange = _.clone(range)
|
||||
# trim to left of cursor
|
||||
lineUpToCursor = editor.getSession().getTextRange(
|
||||
new Range(
|
||||
range.start.row,
|
||||
0,
|
||||
range.start.row,
|
||||
range.start.column,
|
||||
)
|
||||
)
|
||||
# Delete back to last backslash, as appropriate
|
||||
lastBackslashIndex = lineUpToCursor.lastIndexOf('\\')
|
||||
if lastBackslashIndex != -1
|
||||
leftRange.start.column = lastBackslashIndex
|
||||
else
|
||||
leftRange.start.column -= completions.filterText.length
|
||||
editor.session.remove(leftRange)
|
||||
# look at text after cursor
|
||||
lineBeyondCursor = editor.getSession().getTextRange(
|
||||
new Range(
|
||||
rightRange.start.row,
|
||||
rightRange.start.column,
|
||||
rightRange.end.row,
|
||||
99999
|
||||
)
|
||||
)
|
||||
if lineBeyondCursor
|
||||
if partialCommandMatch = lineBeyondCursor.match(/^([a-z0-9]+)\{/)
|
||||
# We've got a partial command after the cursor
|
||||
commandTail = partialCommandMatch[1]
|
||||
# remove rest of the partial command, right of cursor
|
||||
rightRange.end.column += commandTail.length - completions.filterText.length
|
||||
editor.session.remove(rightRange);
|
||||
# trim the completion text to just the command, without braces or brackets
|
||||
# example: '\cite{}' -> '\cite'
|
||||
if matchData.snippet?
|
||||
matchData.snippet = matchData.snippet.replace(/[{\[].*[}\]]/, '')
|
||||
if matchData.caption?
|
||||
matchData.caption = matchData.caption.replace(/[{\[].*[}\]]/, '')
|
||||
if matchData.value?
|
||||
matchData.value = matchData.value.replace(/[{\[].*[}\]]/, '')
|
||||
# finally, insert the match
|
||||
if matchData.snippet
|
||||
aceSnippetManager.insertSnippet(editor, matchData.snippet);
|
||||
else
|
||||
editor.execCommand("insertstring", matchData.value || matchData);
|
||||
|
||||
Autocomplete::_insertMatch.call this, data
|
||||
|
||||
# Overwrite this to set autoInsert = false and set font size
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define [], () ->
|
||||
|
||||
class Parser
|
||||
constructor: (@doc) ->
|
||||
constructor: (@doc, @prefix) ->
|
||||
|
||||
parse: () ->
|
||||
# Safari regex is super slow, freezes browser for minutes on end,
|
||||
|
@ -10,13 +10,17 @@ define [], () ->
|
|||
if window?._ide?.browserIsSafari
|
||||
limit = 100
|
||||
|
||||
commands = []
|
||||
# fully formed commands
|
||||
realCommands = []
|
||||
# commands which match the prefix exactly,
|
||||
# and could be partially typed or malformed
|
||||
incidentalCommands = []
|
||||
seen = {}
|
||||
iterations = 0
|
||||
while command = @nextCommand()
|
||||
iterations += 1
|
||||
if limit && iterations > limit
|
||||
return commands
|
||||
return realCommands
|
||||
|
||||
docState = @doc
|
||||
|
||||
|
@ -29,14 +33,23 @@ define [], () ->
|
|||
args++
|
||||
|
||||
commandHash = "#{command}\\#{optionalArgs}\\#{args}"
|
||||
|
||||
if @prefix? && "\\#{command}" == @prefix
|
||||
incidentalCommands.push [command, optionalArgs, args]
|
||||
else
|
||||
if !seen[commandHash]?
|
||||
seen[commandHash] = true
|
||||
commands.push [command, optionalArgs, args]
|
||||
realCommands.push [command, optionalArgs, args]
|
||||
|
||||
# Reset to before argument to handle nested commands
|
||||
@doc = docState
|
||||
|
||||
return commands
|
||||
# check incidentals, see if we should pluck out a match
|
||||
if incidentalCommands.length > 1
|
||||
bestMatch = incidentalCommands.sort((a, b) => a[1]+a[2] < b[1]+b[2])[0]
|
||||
realCommands.push bestMatch
|
||||
|
||||
return realCommands
|
||||
|
||||
# Ignore single letter commands since auto complete is moot then.
|
||||
commandRegex: /\\([a-zA-Z][a-zA-Z]+)/
|
||||
|
@ -78,12 +91,12 @@ define [], () ->
|
|||
class SuggestionManager
|
||||
getCompletions: (editor, session, pos, prefix, callback) ->
|
||||
doc = session.getValue()
|
||||
parser = new Parser(doc)
|
||||
parser = new Parser(doc, prefix)
|
||||
commands = parser.parse()
|
||||
|
||||
completions = []
|
||||
for command in commands
|
||||
caption = "\\#{command[0]}"
|
||||
score = if caption == prefix then 99 else 50
|
||||
snippet = caption
|
||||
i = 1
|
||||
_.times command[1], () ->
|
||||
|
@ -94,11 +107,11 @@ define [], () ->
|
|||
snippet += "{${#{i}}}"
|
||||
caption += "{}"
|
||||
i++
|
||||
unless caption == prefix
|
||||
completions.push {
|
||||
caption: caption
|
||||
snippet: snippet
|
||||
meta: "cmd"
|
||||
score: score
|
||||
}
|
||||
|
||||
callback null, completions
|
||||
|
|
|
@ -29,6 +29,10 @@ define [
|
|||
if autoComplete != oldAutoComplete
|
||||
settings.saveSettings({autoComplete: autoComplete})
|
||||
|
||||
$scope.$watch "settings.autoPairDelimiters", (autoPairDelimiters, oldAutoPairDelimiters) =>
|
||||
if autoPairDelimiters != oldAutoPairDelimiters
|
||||
settings.saveSettings({autoPairDelimiters: autoPairDelimiters})
|
||||
|
||||
$scope.$watch "settings.pdfViewer", (pdfViewer, oldPdfViewer) =>
|
||||
if pdfViewer != oldPdfViewer
|
||||
settings.saveSettings({pdfViewer: pdfViewer})
|
||||
|
|
|
@ -195,7 +195,282 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
});
|
||||
|
||||
ace.define("ace/mode/latex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/latex_highlight_rules","ace/mode/folding/latex","ace/range","ace/worker/worker_client"], function(require, exports, module) {
|
||||
ace.define("ace/mode/behaviour/latex",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Behaviour = require("../behaviour").Behaviour;
|
||||
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||
var lang = require("../../lib/lang");
|
||||
|
||||
var SAFE_INSERT_IN_TOKENS =
|
||||
["text", "paren.rparen", "punctuation.operator"];
|
||||
var SAFE_INSERT_BEFORE_TOKENS =
|
||||
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||
|
||||
var context;
|
||||
var contextCache = {};
|
||||
var initContext = function(editor) {
|
||||
var id = -1;
|
||||
if (editor.multiSelect) {
|
||||
id = editor.selection.index;
|
||||
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||
}
|
||||
if (contextCache[id])
|
||||
return context = contextCache[id];
|
||||
context = contextCache[id] = {
|
||||
autoInsertedBrackets: 0,
|
||||
autoInsertedRow: -1,
|
||||
autoInsertedLineEnd: "",
|
||||
maybeInsertedBrackets: 0,
|
||||
maybeInsertedRow: -1,
|
||||
maybeInsertedLineStart: "",
|
||||
maybeInsertedLineEnd: ""
|
||||
};
|
||||
};
|
||||
|
||||
var getWrapped = function(selection, selected, opening, closing) {
|
||||
var rowDiff = selection.end.row - selection.start.row;
|
||||
return {
|
||||
text: opening + selected + closing,
|
||||
selection: [
|
||||
0,
|
||||
selection.start.column + 1,
|
||||
rowDiff,
|
||||
selection.end.column + (rowDiff ? 0 : 1)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
var LatexBehaviour = function() {
|
||||
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||
if (editor.completer && editor.completer.popup && editor.completer.popup.isOpen) {
|
||||
return;
|
||||
}
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var lastChar = line[cursor.column-1];
|
||||
if (lastChar === '\\') {
|
||||
return;
|
||||
}
|
||||
if (text == '{') {
|
||||
initContext(editor);
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||
return getWrapped(selection, selected, '{', '}');
|
||||
} else if (LatexBehaviour.isSaneInsertion(editor, session)) {
|
||||
LatexBehaviour.recordAutoInsert(editor, session, "}");
|
||||
return {
|
||||
text: '{}',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
} else if (text == '}') {
|
||||
initContext(editor);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar == '}') {
|
||||
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||
if (matching !== null && LatexBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||
LatexBehaviour.popAutoInsertedClosing();
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||
if (editor.completer && editor.completer.popup && editor.completer.popup.isOpen) {
|
||||
return;
|
||||
}
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && selected == '{') {
|
||||
initContext(editor);
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||
if (rightChar == '}') {
|
||||
range.end.column++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||
if (editor.completer && editor.completer.popup && editor.completer.popup.isOpen) {
|
||||
return;
|
||||
}
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var lastChar = line[cursor.column-1];
|
||||
if (lastChar === '\\') {
|
||||
return;
|
||||
}
|
||||
if (text == '[') {
|
||||
initContext(editor);
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||
return getWrapped(selection, selected, '[', ']');
|
||||
} else if (LatexBehaviour.isSaneInsertion(editor, session)) {
|
||||
LatexBehaviour.recordAutoInsert(editor, session, "]");
|
||||
return {
|
||||
text: '[]',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
} else if (text == ']') {
|
||||
initContext(editor);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar == ']') {
|
||||
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||
if (matching !== null && LatexBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||
LatexBehaviour.popAutoInsertedClosing();
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||
if (editor.completer && editor.completer.popup && editor.completer.popup.isOpen) {
|
||||
return;
|
||||
}
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && selected == '[') {
|
||||
initContext(editor);
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||
if (rightChar == ']') {
|
||||
range.end.column++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("dollars", "insertion", function(state, action, editor, session, text) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var lastChar = line[cursor.column-1];
|
||||
if (lastChar === '\\') {
|
||||
return;
|
||||
}
|
||||
if (text == '$') {
|
||||
if (this.lineCommentStart && this.lineCommentStart.indexOf(text) != -1)
|
||||
return;
|
||||
initContext(editor);
|
||||
var quote = text;
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "" && selected !== "$" && editor.getWrapBehavioursEnabled()) {
|
||||
return getWrapped(selection, selected, quote, quote);
|
||||
} else if (!selected) {
|
||||
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
|
||||
var token = session.getTokenAt(cursor.row, cursor.column);
|
||||
var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
|
||||
|
||||
var stringBefore = token && /string|escape/.test(token.type);
|
||||
var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
|
||||
|
||||
var pair;
|
||||
if (rightChar == quote) {
|
||||
pair = stringBefore !== stringAfter;
|
||||
if (pair && /string\.end/.test(rightToken.type))
|
||||
pair = false;
|
||||
} else {
|
||||
if (stringBefore && !stringAfter)
|
||||
return null; // wrap string with different quote
|
||||
if (stringBefore && stringAfter)
|
||||
return null; // do not pair quotes inside strings
|
||||
var wordRe = session.$mode.tokenRe;
|
||||
wordRe.lastIndex = 0;
|
||||
var isWordBefore = wordRe.test(leftChar);
|
||||
wordRe.lastIndex = 0;
|
||||
var isWordAfter = wordRe.test(leftChar);
|
||||
if (isWordBefore || isWordAfter)
|
||||
return null; // before or after alphanumeric
|
||||
if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
|
||||
return null; // there is rightChar and it isn't closing
|
||||
pair = true;
|
||||
}
|
||||
return {
|
||||
text: pair ? quote + quote : "",
|
||||
selection: [1,1]
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("dollars", "deletion", function(state, action, editor, session, range) {
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && (selected == '$')) {
|
||||
initContext(editor);
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||
if (rightChar == selected) {
|
||||
range.end.column++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
LatexBehaviour.isSaneInsertion = function(editor, session) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||
return false;
|
||||
}
|
||||
iterator.stepForward();
|
||||
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||
};
|
||||
|
||||
LatexBehaviour.$matchTokenType = function(token, types) {
|
||||
return types.indexOf(token.type || token) > -1;
|
||||
};
|
||||
|
||||
LatexBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||
context.autoInsertedBrackets = 0;
|
||||
context.autoInsertedRow = cursor.row;
|
||||
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||
context.autoInsertedBrackets++;
|
||||
};
|
||||
|
||||
LatexBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||
return context.autoInsertedBrackets > 0 &&
|
||||
cursor.row === context.autoInsertedRow &&
|
||||
bracket === context.autoInsertedLineEnd[0] &&
|
||||
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||
};
|
||||
|
||||
LatexBehaviour.popAutoInsertedClosing = function() {
|
||||
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||
context.autoInsertedBrackets--;
|
||||
};
|
||||
|
||||
|
||||
oop.inherits(LatexBehaviour, Behaviour);
|
||||
|
||||
exports.LatexBehaviour = LatexBehaviour;
|
||||
});
|
||||
|
||||
ace.define("ace/mode/latex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/latex_highlight_rules","ace/mode/folding/latex","ace/range","ace/worker/worker_client","ace/mode/behaviour/latex"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
|
@ -204,6 +479,7 @@ var LatexHighlightRules = require("./latex_highlight_rules").LatexHighlightRules
|
|||
var LatexFoldMode = require("./folding/latex").FoldMode;
|
||||
var Range = require("../range").Range;
|
||||
var WorkerClient = require("ace/worker/worker_client").WorkerClient;
|
||||
var LatexBehaviour = require("./behaviour/latex").LatexBehaviour;
|
||||
|
||||
var createLatexWorker = function (session) {
|
||||
var doc = session.getDocument();
|
||||
|
@ -361,6 +637,7 @@ var createLatexWorker = function (session) {
|
|||
var Mode = function() {
|
||||
this.HighlightRules = LatexHighlightRules;
|
||||
this.foldingRules = new LatexFoldMode();
|
||||
this.$behaviour = new LatexBehaviour();
|
||||
this.createWorker = createLatexWorker;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
|
|
@ -195,7 +195,282 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
});
|
||||
|
||||
ace.define("ace/mode/latex_beta",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/latex_highlight_rules","ace/mode/folding/latex","ace/range","ace/worker/worker_client"], function(require, exports, module) {
|
||||
ace.define("ace/mode/behaviour/latex",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Behaviour = require("../behaviour").Behaviour;
|
||||
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||
var lang = require("../../lib/lang");
|
||||
|
||||
var SAFE_INSERT_IN_TOKENS =
|
||||
["text", "paren.rparen", "punctuation.operator"];
|
||||
var SAFE_INSERT_BEFORE_TOKENS =
|
||||
["text", "paren.rparen", "punctuation.operator", "comment"];
|
||||
|
||||
var context;
|
||||
var contextCache = {};
|
||||
var initContext = function(editor) {
|
||||
var id = -1;
|
||||
if (editor.multiSelect) {
|
||||
id = editor.selection.index;
|
||||
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
|
||||
contextCache = {rangeCount: editor.multiSelect.rangeCount};
|
||||
}
|
||||
if (contextCache[id])
|
||||
return context = contextCache[id];
|
||||
context = contextCache[id] = {
|
||||
autoInsertedBrackets: 0,
|
||||
autoInsertedRow: -1,
|
||||
autoInsertedLineEnd: "",
|
||||
maybeInsertedBrackets: 0,
|
||||
maybeInsertedRow: -1,
|
||||
maybeInsertedLineStart: "",
|
||||
maybeInsertedLineEnd: ""
|
||||
};
|
||||
};
|
||||
|
||||
var getWrapped = function(selection, selected, opening, closing) {
|
||||
var rowDiff = selection.end.row - selection.start.row;
|
||||
return {
|
||||
text: opening + selected + closing,
|
||||
selection: [
|
||||
0,
|
||||
selection.start.column + 1,
|
||||
rowDiff,
|
||||
selection.end.column + (rowDiff ? 0 : 1)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
var LatexBehaviour = function() {
|
||||
this.add("braces", "insertion", function(state, action, editor, session, text) {
|
||||
if (editor.completer && editor.completer.popup && editor.completer.popup.isOpen) {
|
||||
return;
|
||||
}
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var lastChar = line[cursor.column-1];
|
||||
if (lastChar === '\\') {
|
||||
return;
|
||||
}
|
||||
if (text == '{') {
|
||||
initContext(editor);
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||
return getWrapped(selection, selected, '{', '}');
|
||||
} else if (LatexBehaviour.isSaneInsertion(editor, session)) {
|
||||
LatexBehaviour.recordAutoInsert(editor, session, "}");
|
||||
return {
|
||||
text: '{}',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
} else if (text == '}') {
|
||||
initContext(editor);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar == '}') {
|
||||
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
||||
if (matching !== null && LatexBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||
LatexBehaviour.popAutoInsertedClosing();
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("braces", "deletion", function(state, action, editor, session, range) {
|
||||
if (editor.completer && editor.completer.popup && editor.completer.popup.isOpen) {
|
||||
return;
|
||||
}
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && selected == '{') {
|
||||
initContext(editor);
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||
if (rightChar == '}') {
|
||||
range.end.column++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("brackets", "insertion", function(state, action, editor, session, text) {
|
||||
if (editor.completer && editor.completer.popup && editor.completer.popup.isOpen) {
|
||||
return;
|
||||
}
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var lastChar = line[cursor.column-1];
|
||||
if (lastChar === '\\') {
|
||||
return;
|
||||
}
|
||||
if (text == '[') {
|
||||
initContext(editor);
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
||||
return getWrapped(selection, selected, '[', ']');
|
||||
} else if (LatexBehaviour.isSaneInsertion(editor, session)) {
|
||||
LatexBehaviour.recordAutoInsert(editor, session, "]");
|
||||
return {
|
||||
text: '[]',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
} else if (text == ']') {
|
||||
initContext(editor);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar == ']') {
|
||||
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
||||
if (matching !== null && LatexBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
||||
LatexBehaviour.popAutoInsertedClosing();
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("brackets", "deletion", function(state, action, editor, session, range) {
|
||||
if (editor.completer && editor.completer.popup && editor.completer.popup.isOpen) {
|
||||
return;
|
||||
}
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && selected == '[') {
|
||||
initContext(editor);
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||
if (rightChar == ']') {
|
||||
range.end.column++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("dollars", "insertion", function(state, action, editor, session, text) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var lastChar = line[cursor.column-1];
|
||||
if (lastChar === '\\') {
|
||||
return;
|
||||
}
|
||||
if (text == '$') {
|
||||
if (this.lineCommentStart && this.lineCommentStart.indexOf(text) != -1)
|
||||
return;
|
||||
initContext(editor);
|
||||
var quote = text;
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "" && selected !== "$" && editor.getWrapBehavioursEnabled()) {
|
||||
return getWrapped(selection, selected, quote, quote);
|
||||
} else if (!selected) {
|
||||
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
|
||||
var token = session.getTokenAt(cursor.row, cursor.column);
|
||||
var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
|
||||
|
||||
var stringBefore = token && /string|escape/.test(token.type);
|
||||
var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
|
||||
|
||||
var pair;
|
||||
if (rightChar == quote) {
|
||||
pair = stringBefore !== stringAfter;
|
||||
if (pair && /string\.end/.test(rightToken.type))
|
||||
pair = false;
|
||||
} else {
|
||||
if (stringBefore && !stringAfter)
|
||||
return null; // wrap string with different quote
|
||||
if (stringBefore && stringAfter)
|
||||
return null; // do not pair quotes inside strings
|
||||
var wordRe = session.$mode.tokenRe;
|
||||
wordRe.lastIndex = 0;
|
||||
var isWordBefore = wordRe.test(leftChar);
|
||||
wordRe.lastIndex = 0;
|
||||
var isWordAfter = wordRe.test(leftChar);
|
||||
if (isWordBefore || isWordAfter)
|
||||
return null; // before or after alphanumeric
|
||||
if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
|
||||
return null; // there is rightChar and it isn't closing
|
||||
pair = true;
|
||||
}
|
||||
return {
|
||||
text: pair ? quote + quote : "",
|
||||
selection: [1,1]
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("dollars", "deletion", function(state, action, editor, session, range) {
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && (selected == '$')) {
|
||||
initContext(editor);
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||
if (rightChar == selected) {
|
||||
range.end.column++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
LatexBehaviour.isSaneInsertion = function(editor, session) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
||||
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
||||
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
||||
return false;
|
||||
}
|
||||
iterator.stepForward();
|
||||
return iterator.getCurrentTokenRow() !== cursor.row ||
|
||||
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
||||
};
|
||||
|
||||
LatexBehaviour.$matchTokenType = function(token, types) {
|
||||
return types.indexOf(token.type || token) > -1;
|
||||
};
|
||||
|
||||
LatexBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
|
||||
context.autoInsertedBrackets = 0;
|
||||
context.autoInsertedRow = cursor.row;
|
||||
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
||||
context.autoInsertedBrackets++;
|
||||
};
|
||||
|
||||
LatexBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||
return context.autoInsertedBrackets > 0 &&
|
||||
cursor.row === context.autoInsertedRow &&
|
||||
bracket === context.autoInsertedLineEnd[0] &&
|
||||
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||
};
|
||||
|
||||
LatexBehaviour.popAutoInsertedClosing = function() {
|
||||
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||
context.autoInsertedBrackets--;
|
||||
};
|
||||
|
||||
|
||||
oop.inherits(LatexBehaviour, Behaviour);
|
||||
|
||||
exports.LatexBehaviour = LatexBehaviour;
|
||||
});
|
||||
|
||||
ace.define("ace/mode/latex_beta",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/latex_highlight_rules","ace/mode/folding/latex","ace/range","ace/worker/worker_client","ace/mode/behaviour/latex"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
|
@ -204,6 +479,7 @@ var LatexHighlightRules = require("./latex_highlight_rules").LatexHighlightRules
|
|||
var LatexFoldMode = require("./folding/latex").FoldMode;
|
||||
var Range = require("../range").Range;
|
||||
var WorkerClient = require("ace/worker/worker_client").WorkerClient;
|
||||
var LatexBehaviour = require("./behaviour/latex").LatexBehaviour;
|
||||
|
||||
var createLatexWorker = function (session) {
|
||||
var doc = session.getDocument();
|
||||
|
@ -361,6 +637,7 @@ var createLatexWorker = function (session) {
|
|||
var Mode = function() {
|
||||
this.HighlightRules = LatexHighlightRules;
|
||||
this.foldingRules = new LatexFoldMode();
|
||||
this.$behaviour = new LatexBehaviour();
|
||||
this.createWorker = createLatexWorker;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
|
|
@ -68,27 +68,33 @@
|
|||
|
||||
form.settings {
|
||||
label {
|
||||
float: left;
|
||||
font-weight: normal;
|
||||
color: @gray-dark;
|
||||
flex: 1 0 50%;
|
||||
margin-bottom: 0;
|
||||
margin-top: 9px;
|
||||
padding-right: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
select {
|
||||
float: right;
|
||||
width: 50%;
|
||||
// height: 30px;
|
||||
// margin: 2px 0;
|
||||
// background: none;
|
||||
// border: none;
|
||||
// box-shadow: none;
|
||||
// color: @link-color;
|
||||
// cursor: pointer;
|
||||
// font-size: 14px;
|
||||
// font-weight: 700;
|
||||
flex: 0 0 50%;
|
||||
margin: 9px 0;
|
||||
}
|
||||
.form-controls {
|
||||
clear: both;
|
||||
padding: (@line-height-computed / 4);
|
||||
padding: 0 9px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
justify-content: flex-end;
|
||||
border-bottom: solid 1px rgba(0, 0, 0, 0.07);
|
||||
&:first-child {
|
||||
margin-top: -9px;
|
||||
}
|
||||
&:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
&:hover {
|
||||
background-color: @link-color;
|
||||
// select.form-control {
|
||||
|
|
Loading…
Reference in a new issue