Issue #858Opened February 12, 2018by poirin2 reactions

[Question] How to extract html/css code in view code automatically?

Question

I need the function to copy the html/css code in the view code component automatically. Is there a predefined function? or I must implement this directly?

Answers (3)

hibunoFebruary 12, 20181 reactions

Hi @poirin ,

I have some solution, last week i have this problem too i try to save current HTML & CSS without manual copying.

And below is my code .


Add custom panel eg. left top button (save button).

  /**
   * Create save button
   * @type {String}
   */
  panelManager.addPanel({
    id: 'customPanel',
    visible    : true,
    buttons    : [{
      id          : 'smile',
      className   : 'fa fa-save',
      attributes  : { title: 'Update Promo' },
      command     : 'customCommand'
    }],
  });

screen shot 2018-02-12 at 16 41 25

And then create save function

  /**
   * Create save function
   */
  commands.add('customCommand', {
    run:  function(editor, sender){
      storageManager.load(['css', 'html'], function(res) {
        // your custom event
        // Note: res variable will return code of css & html
      })
    }
  });

Good luck 👍

artfFebruary 13, 20181 reactions

If you're talking about storing your templates int DB or any other remote endpoint you can setup the built-in RemoteStorage, take a look here #778

lock[bot]September 18, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.