mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Optionally ask the translate local method to HTML encode; use it in the problematic tooltip.
This commit is contained in:
parent
2fcbafa72d
commit
4849c705de
2 changed files with 5 additions and 3 deletions
|
@ -11,6 +11,7 @@ async = require("async")
|
||||||
Modules = require "./Modules"
|
Modules = require "./Modules"
|
||||||
Url = require "url"
|
Url = require "url"
|
||||||
PackageVersions = require "./PackageVersions"
|
PackageVersions = require "./PackageVersions"
|
||||||
|
htmlEncoder = new require("node-html-encoder").Encoder("numerical")
|
||||||
fingerprints = {}
|
fingerprints = {}
|
||||||
Path = require 'path'
|
Path = require 'path'
|
||||||
|
|
||||||
|
@ -151,9 +152,10 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
|
||||||
next()
|
next()
|
||||||
|
|
||||||
webRouter.use (req, res, next)->
|
webRouter.use (req, res, next)->
|
||||||
res.locals.translate = (key, vars = {}) ->
|
res.locals.translate = (key, vars = {}, htmlEncode = false) ->
|
||||||
vars.appName = Settings.appName
|
vars.appName = Settings.appName
|
||||||
req.i18n.translate(key, vars)
|
str = req.i18n.translate(key, vars)
|
||||||
|
if htmlEncode then htmlEncoder.htmlEncode(str) else str
|
||||||
# Don't include the query string parameters, otherwise Google
|
# Don't include the query string parameters, otherwise Google
|
||||||
# treats ?nocdn=true as the canonical version
|
# treats ?nocdn=true as the canonical version
|
||||||
res.locals.currentUrl = Url.parse(req.originalUrl).pathname
|
res.locals.currentUrl = Url.parse(req.originalUrl).pathname
|
||||||
|
|
|
@ -82,7 +82,7 @@ div.full-size(
|
||||||
i.fa.fa-long-arrow-right
|
i.fa.fa-long-arrow-right
|
||||||
br
|
br
|
||||||
a.btn.btn-default.btn-xs(
|
a.btn.btn-default.btn-xs(
|
||||||
tooltip-html="'"+translate('go_to_pdf_location_in_code')+"'"
|
tooltip-html="'"+translate('go_to_pdf_location_in_code', {}, true)+"'"
|
||||||
tooltip-placement="right"
|
tooltip-placement="right"
|
||||||
tooltip-append-to-body="true"
|
tooltip-append-to-body="true"
|
||||||
ng-click="syncToCode()"
|
ng-click="syncToCode()"
|
||||||
|
|
Loading…
Reference in a new issue