CKeditor(4.10.1) - Show Dialog properties Dynamically based on Placeholder selection










0















I am using CkEditor 4.10.1. In this I want to load Placeholder dialog with Dynamic content elements.



Currently It is opening same Dialog with Same elements on every place holder, I want to render dynamic Elements in Dialog.



How can I do this.



Descriptions:



When I click on Agency City placeholder than it is opening one dialog box for that placeholder and Showing the properties.



When I am Clicking on Agency Name placeholder than also it is opening same dialog box with same properties.



I want to display display different properties based on Placeholder selection.
enter image description here



enter image description here



CKEDITOR.addCss('span > .cke_placeholder background-color: #ffeec2; ');

CKEDITOR.plugins.add('autotag', requires:autocomplete,textmatch,toolbar,wysiwygarea,basicstyles,link,undo,placeholder,widget,dialog',
height: 340,
init: function (editor)
editor.on('instanceReady', function (evt)
var config = ;
function textTestCallback(range)
if (!range.collapsed)
return null;

return CKEDITOR.plugins.textMatch.match(range, matchCallback);


function matchCallback(text, offset) ])*$/,
match = text.slice(0, offset)
.match(pattern);
if (!match)
return null;

return
start: match.index,
end: offset
;

config.textTestCallback = textTestCallback;
//The itemsArray variable is the example "database".

var itemsArray = [

id: 1,
name: 'Address',
description: 'Customer Support address.'
,

id: 2,
name: 'AssigneeName',
description: 'Ticket assignee name.'
,

id: 3,
name: 'DeadlineTime',
description: 'Time for the technician to handle this issue.'
,

id: 4,
name: 'DepartmentName',
description: 'Department name responsible for handling this ticket.'
,

id: 5,
name: 'CaseID',
description: 'Unique case number used to distinguish tickets.'
,

id: 6,
name: 'CaseName',
description: 'Name of the ticket provided by the user.'
,

id: 7,
name: 'ContactEmail',
description: 'Customer Support contact e-mail address.'
,

id: 8,
name: 'CustomerName',
description: 'Recipient of your response.'
,

id: 9,
name: 'HotlineNumber',
description: 'Customer Support Hotline number.'
,

id: 10,
name: 'TechnicianName',
description: 'Technician who will handle this ticket.'

];

function dataCallback(matchInfo, callback)
var data = itemsArray.filter(function (item)
var itemName = '[[' + item.name.toLowerCase() + ']]';
return itemName.indexOf(matchInfo.query.toLowerCase()) == 0;
);
callback(data);


config.dataCallback = dataCallback;

// Define the templates of the autocomplete suggestions dropdown and output text.
config.itemTemplate = '<li data-id="id">' +
'<div><strong class="item-title">name</strong></div>' +
'<div><i>description</i></div>' +
'</li>';
config.outputTemplate = '[[name]]<span>&nbsp;</span>';

// Attach autocomplete to the editor.
new CKEDITOR.plugins.autocomplete(editor, config);
);

// Register dialog.
CKEDITOR.dialog.add('placeholder', function (editor)
debugger;
alert('dialog Placeholder' + editor._.dataStore.id);
var lang = editor.lang.placeholder,
generalLabel = editor.lang.common.generalTab,
validNameRegex = /^[^[]<>]+$/;
var itms = new Array();
itms[0] = new Array();
itms[0][0] = "Meeting Time";
itms[0][1] = "meetingTime";
itms[1] = new Array();
itms[1][0] = "Meeting Location";
itms[1][1] = "meetingLoc";
return
title: "Properties",
minWidth: 300,
minHeight: 400,
onShow: function ()
//alert("Show");
//Removed
,
onOk: function ()
//Removed
//alert("Ok");
,
onCancel: function ()
//Removed
//alert("Cancel");
,
contents: [

id: 'info',
//label: generalLabel,
//title: generalLabel,
label: "Properties",
title: "Properties",
elements: [

id: 'id',
type: 'select',
style: 'width: 100%;',
//label: lang.name,
label: "Id",
items: itms,
'default': 'meetingLocation',
required: true,
validate: CKEDITOR.dialog.validate.regex(validNameRegex, lang.invalidName),
setup: function (widget)
//this.setValue(widget.data.name);
this.setValue('meetingTime');
,
commit: function (widget)
widget.setData('id', this.getValue());

,

id: 'name',
type: 'text',
style: 'width: 100%;',
//label: lang.name,
label: "Name",
'default': '',
required: true,
validate: CKEDITOR.dialog.validate.regex(validNameRegex, lang.invalidName),
setup: function (widget)
this.setValue(widget.data.name);
,
commit: function (widget)
console.log(widget.data);
widget.setData('name', this.getValue());


]

]
;
);

CKEDITOR.on('dialogDefinition', function (ev)
// Take the dialog name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
);
);


Thanks in Advance. your help is highly appreciated.










share|improve this question


























    0















    I am using CkEditor 4.10.1. In this I want to load Placeholder dialog with Dynamic content elements.



    Currently It is opening same Dialog with Same elements on every place holder, I want to render dynamic Elements in Dialog.



    How can I do this.



    Descriptions:



    When I click on Agency City placeholder than it is opening one dialog box for that placeholder and Showing the properties.



    When I am Clicking on Agency Name placeholder than also it is opening same dialog box with same properties.



    I want to display display different properties based on Placeholder selection.
    enter image description here



    enter image description here



    CKEDITOR.addCss('span > .cke_placeholder background-color: #ffeec2; ');

    CKEDITOR.plugins.add('autotag', requires:autocomplete,textmatch,toolbar,wysiwygarea,basicstyles,link,undo,placeholder,widget,dialog',
    height: 340,
    init: function (editor)
    editor.on('instanceReady', function (evt)
    var config = ;
    function textTestCallback(range)
    if (!range.collapsed)
    return null;

    return CKEDITOR.plugins.textMatch.match(range, matchCallback);


    function matchCallback(text, offset) ])*$/,
    match = text.slice(0, offset)
    .match(pattern);
    if (!match)
    return null;

    return
    start: match.index,
    end: offset
    ;

    config.textTestCallback = textTestCallback;
    //The itemsArray variable is the example "database".

    var itemsArray = [

    id: 1,
    name: 'Address',
    description: 'Customer Support address.'
    ,

    id: 2,
    name: 'AssigneeName',
    description: 'Ticket assignee name.'
    ,

    id: 3,
    name: 'DeadlineTime',
    description: 'Time for the technician to handle this issue.'
    ,

    id: 4,
    name: 'DepartmentName',
    description: 'Department name responsible for handling this ticket.'
    ,

    id: 5,
    name: 'CaseID',
    description: 'Unique case number used to distinguish tickets.'
    ,

    id: 6,
    name: 'CaseName',
    description: 'Name of the ticket provided by the user.'
    ,

    id: 7,
    name: 'ContactEmail',
    description: 'Customer Support contact e-mail address.'
    ,

    id: 8,
    name: 'CustomerName',
    description: 'Recipient of your response.'
    ,

    id: 9,
    name: 'HotlineNumber',
    description: 'Customer Support Hotline number.'
    ,

    id: 10,
    name: 'TechnicianName',
    description: 'Technician who will handle this ticket.'

    ];

    function dataCallback(matchInfo, callback)
    var data = itemsArray.filter(function (item)
    var itemName = '[[' + item.name.toLowerCase() + ']]';
    return itemName.indexOf(matchInfo.query.toLowerCase()) == 0;
    );
    callback(data);


    config.dataCallback = dataCallback;

    // Define the templates of the autocomplete suggestions dropdown and output text.
    config.itemTemplate = '<li data-id="id">' +
    '<div><strong class="item-title">name</strong></div>' +
    '<div><i>description</i></div>' +
    '</li>';
    config.outputTemplate = '[[name]]<span>&nbsp;</span>';

    // Attach autocomplete to the editor.
    new CKEDITOR.plugins.autocomplete(editor, config);
    );

    // Register dialog.
    CKEDITOR.dialog.add('placeholder', function (editor)
    debugger;
    alert('dialog Placeholder' + editor._.dataStore.id);
    var lang = editor.lang.placeholder,
    generalLabel = editor.lang.common.generalTab,
    validNameRegex = /^[^[]<>]+$/;
    var itms = new Array();
    itms[0] = new Array();
    itms[0][0] = "Meeting Time";
    itms[0][1] = "meetingTime";
    itms[1] = new Array();
    itms[1][0] = "Meeting Location";
    itms[1][1] = "meetingLoc";
    return
    title: "Properties",
    minWidth: 300,
    minHeight: 400,
    onShow: function ()
    //alert("Show");
    //Removed
    ,
    onOk: function ()
    //Removed
    //alert("Ok");
    ,
    onCancel: function ()
    //Removed
    //alert("Cancel");
    ,
    contents: [

    id: 'info',
    //label: generalLabel,
    //title: generalLabel,
    label: "Properties",
    title: "Properties",
    elements: [

    id: 'id',
    type: 'select',
    style: 'width: 100%;',
    //label: lang.name,
    label: "Id",
    items: itms,
    'default': 'meetingLocation',
    required: true,
    validate: CKEDITOR.dialog.validate.regex(validNameRegex, lang.invalidName),
    setup: function (widget)
    //this.setValue(widget.data.name);
    this.setValue('meetingTime');
    ,
    commit: function (widget)
    widget.setData('id', this.getValue());

    ,

    id: 'name',
    type: 'text',
    style: 'width: 100%;',
    //label: lang.name,
    label: "Name",
    'default': '',
    required: true,
    validate: CKEDITOR.dialog.validate.regex(validNameRegex, lang.invalidName),
    setup: function (widget)
    this.setValue(widget.data.name);
    ,
    commit: function (widget)
    console.log(widget.data);
    widget.setData('name', this.getValue());


    ]

    ]
    ;
    );

    CKEDITOR.on('dialogDefinition', function (ev)
    // Take the dialog name and its definition from the event data.
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;
    );
    );


    Thanks in Advance. your help is highly appreciated.










    share|improve this question
























      0












      0








      0








      I am using CkEditor 4.10.1. In this I want to load Placeholder dialog with Dynamic content elements.



      Currently It is opening same Dialog with Same elements on every place holder, I want to render dynamic Elements in Dialog.



      How can I do this.



      Descriptions:



      When I click on Agency City placeholder than it is opening one dialog box for that placeholder and Showing the properties.



      When I am Clicking on Agency Name placeholder than also it is opening same dialog box with same properties.



      I want to display display different properties based on Placeholder selection.
      enter image description here



      enter image description here



      CKEDITOR.addCss('span > .cke_placeholder background-color: #ffeec2; ');

      CKEDITOR.plugins.add('autotag', requires:autocomplete,textmatch,toolbar,wysiwygarea,basicstyles,link,undo,placeholder,widget,dialog',
      height: 340,
      init: function (editor)
      editor.on('instanceReady', function (evt)
      var config = ;
      function textTestCallback(range)
      if (!range.collapsed)
      return null;

      return CKEDITOR.plugins.textMatch.match(range, matchCallback);


      function matchCallback(text, offset) ])*$/,
      match = text.slice(0, offset)
      .match(pattern);
      if (!match)
      return null;

      return
      start: match.index,
      end: offset
      ;

      config.textTestCallback = textTestCallback;
      //The itemsArray variable is the example "database".

      var itemsArray = [

      id: 1,
      name: 'Address',
      description: 'Customer Support address.'
      ,

      id: 2,
      name: 'AssigneeName',
      description: 'Ticket assignee name.'
      ,

      id: 3,
      name: 'DeadlineTime',
      description: 'Time for the technician to handle this issue.'
      ,

      id: 4,
      name: 'DepartmentName',
      description: 'Department name responsible for handling this ticket.'
      ,

      id: 5,
      name: 'CaseID',
      description: 'Unique case number used to distinguish tickets.'
      ,

      id: 6,
      name: 'CaseName',
      description: 'Name of the ticket provided by the user.'
      ,

      id: 7,
      name: 'ContactEmail',
      description: 'Customer Support contact e-mail address.'
      ,

      id: 8,
      name: 'CustomerName',
      description: 'Recipient of your response.'
      ,

      id: 9,
      name: 'HotlineNumber',
      description: 'Customer Support Hotline number.'
      ,

      id: 10,
      name: 'TechnicianName',
      description: 'Technician who will handle this ticket.'

      ];

      function dataCallback(matchInfo, callback)
      var data = itemsArray.filter(function (item)
      var itemName = '[[' + item.name.toLowerCase() + ']]';
      return itemName.indexOf(matchInfo.query.toLowerCase()) == 0;
      );
      callback(data);


      config.dataCallback = dataCallback;

      // Define the templates of the autocomplete suggestions dropdown and output text.
      config.itemTemplate = '<li data-id="id">' +
      '<div><strong class="item-title">name</strong></div>' +
      '<div><i>description</i></div>' +
      '</li>';
      config.outputTemplate = '[[name]]<span>&nbsp;</span>';

      // Attach autocomplete to the editor.
      new CKEDITOR.plugins.autocomplete(editor, config);
      );

      // Register dialog.
      CKEDITOR.dialog.add('placeholder', function (editor)
      debugger;
      alert('dialog Placeholder' + editor._.dataStore.id);
      var lang = editor.lang.placeholder,
      generalLabel = editor.lang.common.generalTab,
      validNameRegex = /^[^[]<>]+$/;
      var itms = new Array();
      itms[0] = new Array();
      itms[0][0] = "Meeting Time";
      itms[0][1] = "meetingTime";
      itms[1] = new Array();
      itms[1][0] = "Meeting Location";
      itms[1][1] = "meetingLoc";
      return
      title: "Properties",
      minWidth: 300,
      minHeight: 400,
      onShow: function ()
      //alert("Show");
      //Removed
      ,
      onOk: function ()
      //Removed
      //alert("Ok");
      ,
      onCancel: function ()
      //Removed
      //alert("Cancel");
      ,
      contents: [

      id: 'info',
      //label: generalLabel,
      //title: generalLabel,
      label: "Properties",
      title: "Properties",
      elements: [

      id: 'id',
      type: 'select',
      style: 'width: 100%;',
      //label: lang.name,
      label: "Id",
      items: itms,
      'default': 'meetingLocation',
      required: true,
      validate: CKEDITOR.dialog.validate.regex(validNameRegex, lang.invalidName),
      setup: function (widget)
      //this.setValue(widget.data.name);
      this.setValue('meetingTime');
      ,
      commit: function (widget)
      widget.setData('id', this.getValue());

      ,

      id: 'name',
      type: 'text',
      style: 'width: 100%;',
      //label: lang.name,
      label: "Name",
      'default': '',
      required: true,
      validate: CKEDITOR.dialog.validate.regex(validNameRegex, lang.invalidName),
      setup: function (widget)
      this.setValue(widget.data.name);
      ,
      commit: function (widget)
      console.log(widget.data);
      widget.setData('name', this.getValue());


      ]

      ]
      ;
      );

      CKEDITOR.on('dialogDefinition', function (ev)
      // Take the dialog name and its definition from the event data.
      var dialogName = ev.data.name;
      var dialogDefinition = ev.data.definition;
      );
      );


      Thanks in Advance. your help is highly appreciated.










      share|improve this question














      I am using CkEditor 4.10.1. In this I want to load Placeholder dialog with Dynamic content elements.



      Currently It is opening same Dialog with Same elements on every place holder, I want to render dynamic Elements in Dialog.



      How can I do this.



      Descriptions:



      When I click on Agency City placeholder than it is opening one dialog box for that placeholder and Showing the properties.



      When I am Clicking on Agency Name placeholder than also it is opening same dialog box with same properties.



      I want to display display different properties based on Placeholder selection.
      enter image description here



      enter image description here



      CKEDITOR.addCss('span > .cke_placeholder background-color: #ffeec2; ');

      CKEDITOR.plugins.add('autotag', requires:autocomplete,textmatch,toolbar,wysiwygarea,basicstyles,link,undo,placeholder,widget,dialog',
      height: 340,
      init: function (editor)
      editor.on('instanceReady', function (evt)
      var config = ;
      function textTestCallback(range)
      if (!range.collapsed)
      return null;

      return CKEDITOR.plugins.textMatch.match(range, matchCallback);


      function matchCallback(text, offset) ])*$/,
      match = text.slice(0, offset)
      .match(pattern);
      if (!match)
      return null;

      return
      start: match.index,
      end: offset
      ;

      config.textTestCallback = textTestCallback;
      //The itemsArray variable is the example "database".

      var itemsArray = [

      id: 1,
      name: 'Address',
      description: 'Customer Support address.'
      ,

      id: 2,
      name: 'AssigneeName',
      description: 'Ticket assignee name.'
      ,

      id: 3,
      name: 'DeadlineTime',
      description: 'Time for the technician to handle this issue.'
      ,

      id: 4,
      name: 'DepartmentName',
      description: 'Department name responsible for handling this ticket.'
      ,

      id: 5,
      name: 'CaseID',
      description: 'Unique case number used to distinguish tickets.'
      ,

      id: 6,
      name: 'CaseName',
      description: 'Name of the ticket provided by the user.'
      ,

      id: 7,
      name: 'ContactEmail',
      description: 'Customer Support contact e-mail address.'
      ,

      id: 8,
      name: 'CustomerName',
      description: 'Recipient of your response.'
      ,

      id: 9,
      name: 'HotlineNumber',
      description: 'Customer Support Hotline number.'
      ,

      id: 10,
      name: 'TechnicianName',
      description: 'Technician who will handle this ticket.'

      ];

      function dataCallback(matchInfo, callback)
      var data = itemsArray.filter(function (item)
      var itemName = '[[' + item.name.toLowerCase() + ']]';
      return itemName.indexOf(matchInfo.query.toLowerCase()) == 0;
      );
      callback(data);


      config.dataCallback = dataCallback;

      // Define the templates of the autocomplete suggestions dropdown and output text.
      config.itemTemplate = '<li data-id="id">' +
      '<div><strong class="item-title">name</strong></div>' +
      '<div><i>description</i></div>' +
      '</li>';
      config.outputTemplate = '[[name]]<span>&nbsp;</span>';

      // Attach autocomplete to the editor.
      new CKEDITOR.plugins.autocomplete(editor, config);
      );

      // Register dialog.
      CKEDITOR.dialog.add('placeholder', function (editor)
      debugger;
      alert('dialog Placeholder' + editor._.dataStore.id);
      var lang = editor.lang.placeholder,
      generalLabel = editor.lang.common.generalTab,
      validNameRegex = /^[^[]<>]+$/;
      var itms = new Array();
      itms[0] = new Array();
      itms[0][0] = "Meeting Time";
      itms[0][1] = "meetingTime";
      itms[1] = new Array();
      itms[1][0] = "Meeting Location";
      itms[1][1] = "meetingLoc";
      return
      title: "Properties",
      minWidth: 300,
      minHeight: 400,
      onShow: function ()
      //alert("Show");
      //Removed
      ,
      onOk: function ()
      //Removed
      //alert("Ok");
      ,
      onCancel: function ()
      //Removed
      //alert("Cancel");
      ,
      contents: [

      id: 'info',
      //label: generalLabel,
      //title: generalLabel,
      label: "Properties",
      title: "Properties",
      elements: [

      id: 'id',
      type: 'select',
      style: 'width: 100%;',
      //label: lang.name,
      label: "Id",
      items: itms,
      'default': 'meetingLocation',
      required: true,
      validate: CKEDITOR.dialog.validate.regex(validNameRegex, lang.invalidName),
      setup: function (widget)
      //this.setValue(widget.data.name);
      this.setValue('meetingTime');
      ,
      commit: function (widget)
      widget.setData('id', this.getValue());

      ,

      id: 'name',
      type: 'text',
      style: 'width: 100%;',
      //label: lang.name,
      label: "Name",
      'default': '',
      required: true,
      validate: CKEDITOR.dialog.validate.regex(validNameRegex, lang.invalidName),
      setup: function (widget)
      this.setValue(widget.data.name);
      ,
      commit: function (widget)
      console.log(widget.data);
      widget.setData('name', this.getValue());


      ]

      ]
      ;
      );

      CKEDITOR.on('dialogDefinition', function (ev)
      // Take the dialog name and its definition from the event data.
      var dialogName = ev.data.name;
      var dialogDefinition = ev.data.definition;
      );
      );


      Thanks in Advance. your help is highly appreciated.







      javascript dialog ckeditor angular5






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 '18 at 8:07









      Mitesh GadhiyaMitesh Gadhiya

      176111




      176111






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314890%2fckeditor4-10-1-show-dialog-properties-dynamically-based-on-placeholder-selec%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314890%2fckeditor4-10-1-show-dialog-properties-dynamically-based-on-placeholder-selec%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3

          Museum of Modern and Contemporary Art of Trento and Rovereto