Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 1 | <!-- |
Dave Borowitz | 8cdc76b | 2018-03-26 10:04:27 -0400 | [diff] [blame] | 2 | @license |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 3 | Copyright (C) 2017 The Android Open Source Project |
| 4 | |
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | you may not use this file except in compliance with the License. |
| 7 | You may obtain a copy of the License at |
| 8 | |
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, software |
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | See the License for the specific language governing permissions and |
| 15 | limitations under the License. |
| 16 | --> |
| 17 | |
Ole Rehmsen | 3164074 | 2019-05-16 11:24:47 +0200 | [diff] [blame^] | 18 | <link rel="import" href="/bower_components/polymer/polymer.html"> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 19 | |
| 20 | <link rel="import" href="../../../behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html"> |
| 21 | <link rel="import" href="../../../behaviors/gr-path-list-behavior/gr-path-list-behavior.html"> |
| 22 | <link rel="import" href="../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html"> |
| 23 | <link rel="import" href="../../core/gr-navigation/gr-navigation.html"> |
Kasper Nilsson | caf31c1 | 2017-10-25 15:18:09 -0700 | [diff] [blame] | 24 | <link rel="import" href="../../plugins/gr-endpoint-decorator/gr-endpoint-decorator.html"> |
| 25 | <link rel="import" href="../../plugins/gr-endpoint-param/gr-endpoint-param.html"> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 26 | <link rel="import" href="../../shared/gr-button/gr-button.html"> |
| 27 | <link rel="import" href="../../shared/gr-editable-label/gr-editable-label.html"> |
Becky Siegel | 377e289 | 2018-03-15 19:34:49 +0000 | [diff] [blame] | 28 | <link rel="import" href="../../shared/gr-fixed-panel/gr-fixed-panel.html"> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 29 | <link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html"> |
Kasper Nilsson | aa4a07e | 2018-04-03 16:14:47 -0700 | [diff] [blame] | 30 | <link rel="import" href="../../shared/gr-storage/gr-storage.html"> |
Kasper Nilsson | 8819114 | 2017-12-19 14:54:15 -0800 | [diff] [blame] | 31 | <link rel="import" href="../gr-default-editor/gr-default-editor.html"> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 32 | <link rel="import" href="../../../styles/shared-styles.html"> |
| 33 | |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 34 | <dom-module id="gr-editor-view"> |
| 35 | <template> |
| 36 | <style include="shared-styles"> |
| 37 | :host { |
| 38 | background-color: var(--view-background-color); |
| 39 | } |
Becky Siegel | 377e289 | 2018-03-15 19:34:49 +0000 | [diff] [blame] | 40 | gr-fixed-panel { |
Kasper Nilsson | 76b0f73 | 2018-04-17 14:49:00 +0200 | [diff] [blame] | 41 | background-color: var(--edit-mode-background-color); |
Kasper Nilsson | c828098 | 2018-04-11 15:32:06 -0700 | [diff] [blame] | 42 | border-bottom: 1px var(--border-color) solid; |
Kasper Nilsson | ea00f8c | 2018-01-03 10:25:44 -0800 | [diff] [blame] | 43 | z-index: 1; |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 44 | } |
| 45 | header, |
| 46 | .subHeader { |
| 47 | align-items: center; |
| 48 | display: flex; |
| 49 | justify-content: space-between; |
| 50 | padding: .75em var(--default-horizontal-margin); |
| 51 | } |
| 52 | header gr-editable-label { |
Kasper Nilsson | 122f898 | 2018-02-09 13:46:50 -0800 | [diff] [blame] | 53 | font-size: var(--font-size-large); |
Kasper Nilsson | 2e15ea2 | 2018-02-05 13:42:36 -0800 | [diff] [blame] | 54 | --label-style: { |
| 55 | text-overflow: initial; |
| 56 | white-space: initial; |
| 57 | word-break: break-all; |
| 58 | } |
| 59 | --input-style: { |
| 60 | margin-top: 1em; |
| 61 | } |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 62 | } |
| 63 | .textareaWrapper { |
Kasper Nilsson | c828098 | 2018-04-11 15:32:06 -0700 | [diff] [blame] | 64 | border: 1px solid var(--border-color); |
Kasper Nilsson | 6cf8997 | 2018-01-30 17:23:54 -0800 | [diff] [blame] | 65 | border-radius: 3px; |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 66 | margin: var(--default-horizontal-margin); |
| 67 | } |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 68 | .textareaWrapper .editButtons { |
| 69 | display: none; |
| 70 | } |
Kasper Nilsson | 122f898 | 2018-02-09 13:46:50 -0800 | [diff] [blame] | 71 | .controlGroup { |
| 72 | align-items: center; |
| 73 | display: flex; |
| 74 | font-size: var(--font-size-large); |
| 75 | } |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 76 | .rightControls { |
Kasper Nilsson | 6cf8997 | 2018-01-30 17:23:54 -0800 | [diff] [blame] | 77 | justify-content: flex-end; |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 78 | } |
Kasper Nilsson | 2e15ea2 | 2018-02-05 13:42:36 -0800 | [diff] [blame] | 79 | @media screen and (max-width: 50em) { |
| 80 | header, |
| 81 | .subHeader { |
| 82 | display: block; |
| 83 | } |
| 84 | .rightControls { |
| 85 | float: right; |
| 86 | } |
| 87 | } |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 88 | </style> |
Becky Siegel | 377e289 | 2018-03-15 19:34:49 +0000 | [diff] [blame] | 89 | <gr-fixed-panel keep-on-scroll> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 90 | <header> |
Kasper Nilsson | 122f898 | 2018-02-09 13:46:50 -0800 | [diff] [blame] | 91 | <span class="controlGroup"> |
| 92 | <span>Edit mode</span> |
| 93 | <span class="separator"></span> |
| 94 | <gr-editable-label |
| 95 | label-text="File path" |
| 96 | value="[[_path]]" |
| 97 | placeholder="File path..." |
| 98 | on-changed="_handlePathChanged"></gr-editable-label> |
| 99 | </span> |
| 100 | <span class="controlGroup rightControls"> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 101 | <gr-button |
Kasper Nilsson | 5c6a5cd | 2018-01-18 16:41:59 -0800 | [diff] [blame] | 102 | id="close" |
| 103 | link |
| 104 | on-tap="_handleCloseTap">Close</gr-button> |
| 105 | <gr-button |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 106 | id="save" |
| 107 | disabled$="[[_saveDisabled]]" |
| 108 | primary |
Kasper Nilsson | 5c6a5cd | 2018-01-18 16:41:59 -0800 | [diff] [blame] | 109 | link |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 110 | on-tap="_saveEdit">Save</gr-button> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 111 | </span> |
| 112 | </header> |
Becky Siegel | 377e289 | 2018-03-15 19:34:49 +0000 | [diff] [blame] | 113 | </gr-fixed-panel> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 114 | <div class="textareaWrapper"> |
Kasper Nilsson | 6c39ab9 | 2017-12-14 15:41:00 -0800 | [diff] [blame] | 115 | <gr-endpoint-decorator id="editorEndpoint" name="editor"> |
Kasper Nilsson | bb7ae96 | 2017-12-12 15:05:22 -0800 | [diff] [blame] | 116 | <gr-endpoint-param name="fileContent" value="[[_newContent]]"></gr-endpoint-param> |
| 117 | <gr-endpoint-param name="prefs" value="[[_prefs]]"></gr-endpoint-param> |
| 118 | <gr-endpoint-param name="fileType" value="[[_type]]"></gr-endpoint-param> |
Kasper Nilsson | 8819114 | 2017-12-19 14:54:15 -0800 | [diff] [blame] | 119 | <gr-default-editor id="file" file-content="[[_newContent]]"></gr-default-editor> |
Kasper Nilsson | caf31c1 | 2017-10-25 15:18:09 -0700 | [diff] [blame] | 120 | </gr-endpoint-decorator> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 121 | </div> |
| 122 | <gr-rest-api-interface id="restAPI"></gr-rest-api-interface> |
Kasper Nilsson | aa4a07e | 2018-04-03 16:14:47 -0700 | [diff] [blame] | 123 | <gr-storage id="storage"></gr-storage> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 124 | </template> |
| 125 | <script src="gr-editor-view.js"></script> |
Dave Borowitz | 8cdc76b | 2018-03-26 10:04:27 -0400 | [diff] [blame] | 126 | </dom-module> |