Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

238
Visualizações
How can I change ckeditor placeholder Plugin Default Enclosure?

I am using CKEditor 4 with Placeholder plugin, when I add a placeholder (FirstName), I want it to be printed with single brackets instead of double: ([FirstName] instead of [[FirstName]]). I have tried to change it from 'after init' function but didn't work. I installed ckeditor 4 package with Placeholder plugin included.

ckeditor.js:

CKEDITOR.plugins.add("placeholder", {
        requires: "widget,dialog", onLoad: function () { CKEDITOR.addCss(".cke_placeholder{background-color:#ff0}") }, init: function (a) {
            var b = a.lang.placeholder; CKEDITOR.dialog.add("placeholder", this.path + "dialogs/placeholder.js"); a.widgets.add("placeholder", {
                dialog: "placeholder", pathName: b.pathName, template: '\x3cspan class\x3d"cke_placeholder"\x3e[[]]\x3c/span\x3e', downcast: function () { return new CKEDITOR.htmlParser.text("[[" + this.data.name + "]]") }, init: function () {
                    this.setData("name",
                        this.element.getText().slice(2, -2))
                }, data: function () { this.element.setText("[[" + this.data.name + "]]") }, getLabel: function () { return this.editor.lang.widget.label.replace(/%1/, this.data.name + " " + this.pathName) }
            }); a.ui.addButton && a.ui.addButton("CreatePlaceholder", { label: b.toolbar, command: "placeholder", toolbar: "insert,5", icon: "placeholder" })
        }, afterInit: function (a) {
            var b = /\[\[([^\[\]])+\]\]/g; a.dataProcessor.dataFilter.addRules({
                text: function (f, d) {
                    var e = d.parent && CKEDITOR.dtd[d.parent.name]; if (!e || e.span) return f.replace(b,
                        function (b) { var c = null, c = new CKEDITOR.htmlParser.element("span", { "class": "cke_placeholder" }); c.add(new CKEDITOR.htmlParser.text(b)); c = a.widgets.wrapElement(c, "placeholder"); return c.getOuterHtml() })
                }
            })
        }
    })

placeholder.js

CKEDITOR.dialog.add("placeholder", function (a) { var b = a.lang.placeholder; a = a.lang.common.generalTab; return { title: b.title, minWidth: 300, minHeight: 80, contents: [{ id: "info", label: a, title: a, elements: [{ id: "name", type: "text", style: "width: 100%;", label: b.name, "default": "", required: !0, validate: CKEDITOR.dialog.validate.regex(/^[^\[\]<>]+$/, b.invalidName), setup: function (a) { this.setValue(a.data.name) }, commit: function (a) { a.setData("name", this.getValue()) } }] }] } });
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda