diff --git a/app/Code.gs b/app/Code.gs index 01d5a5c..b98df38 100644 --- a/app/Code.gs +++ b/app/Code.gs @@ -5,6 +5,8 @@ function onOpen() { DocumentApp.getUi().createAddonMenu() .addItem('Convert all', 'showDialogConvertAll') .addItem('Convert selection', 'showDialogConvertSelection') + .addSeparator() + .addItem('Configure converter', 'showDialogConfiguration') .addToUi(); } @@ -25,6 +27,15 @@ function showDialogConvertSelection() { showDialog(); } +function showDialogConfiguration() { + var ui = HtmlService.createHtmlOutputFromFile('ConfigurationPanel') + .setWidth(400) + .setHeight(300) + .setTitle('Converter configuration'); + + DocumentApp.getUi().showModalDialog(ui, 'Converter configuration'); +} + /** * Opens a dialog containing the add-on's user interface. */ @@ -37,6 +48,28 @@ function showDialog() { DocumentApp.getUi().showModalDialog(ui, 'AsciiDoc Processor'); } +/** + * Gets the stored user preferences for the convert, if they exist. + * + * @return {Object} The user's preferences, if they exist. + */ +function getPreferences() { + var userProperties = PropertiesService.getUserProperties(); + var prefs = { + extraSpaceAroundListing: userProperties.getProperty('extraSpaceAroundListing'), + explicitAnchorId: userProperties.getProperty('explicitAnchorId') + }; + return prefs; +} + +/** + * Saves user preferences for the convert. + */ +function savePreferences(prefs) { + var userProperties = PropertiesService.getUserProperties(); + userProperties.setProperties(prefs); +} + function asciidocify() { var selection = DocumentApp.getActiveDocument().getSelection(); var elements = []; diff --git a/app/ConfigurationPanel.html b/app/ConfigurationPanel.html new file mode 100644 index 0000000..686aea9 --- /dev/null +++ b/app/ConfigurationPanel.html @@ -0,0 +1,110 @@ + + + + + + + +
+
+
+
+ +
+ + + + diff --git a/app/Dialog.html b/app/Dialog.html index c5318a0..b1c0583 100644 --- a/app/Dialog.html +++ b/app/Dialog.html @@ -1,15 +1,11 @@
-
+
Converting...
+
+