Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

236
Views
¿Cómo puedo cambiar el contenedor predeterminado del complemento de marcador de posición de ckeditor?

Estoy usando CKEditor 4 con el complemento Placeholder, cuando agrego un marcador de posición (FirstName), quiero que se imprima con corchetes simples en lugar de doble: ([FirstName] en lugar de [[FirstName]]). Intenté cambiarlo de la función 'después de iniciar' pero no funcionó. Instalé el paquete ckeditor 4 con el complemento de marcador de posición incluido.

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() }) } }) } })

marcador de posición.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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!