Dave Borowitz | 8cdc76b | 2018-03-26 10:04:27 -0400 | [diff] [blame] | 1 | /** |
| 2 | * @license |
| 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 | */ |
Dmitrii Filippov | daf0ec9 | 2020-03-17 11:27:28 +0100 | [diff] [blame] | 17 | import '../../../scripts/bundled-polymer.js'; |
Kasper Nilsson | 8819114 | 2017-12-19 14:54:15 -0800 | [diff] [blame] | 18 | |
Dmitrii Filippov | daf0ec9 | 2020-03-17 11:27:28 +0100 | [diff] [blame] | 19 | import '../../../styles/shared-styles.js'; |
| 20 | import {GestureEventListeners} from '@polymer/polymer/lib/mixins/gesture-event-listeners.js'; |
| 21 | import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; |
| 22 | import {PolymerElement} from '@polymer/polymer/polymer-element.js'; |
| 23 | import {htmlTemplate} from './gr-default-editor_html.js'; |
Kasper Nilsson | 8819114 | 2017-12-19 14:54:15 -0800 | [diff] [blame] | 24 | |
Dmitrii Filippov | daf0ec9 | 2020-03-17 11:27:28 +0100 | [diff] [blame] | 25 | /** @extends Polymer.Element */ |
| 26 | class GrDefaultEditor extends GestureEventListeners( |
| 27 | LegacyElementMixin( |
| 28 | PolymerElement)) { |
| 29 | static get template() { return htmlTemplate; } |
Kasper Nilsson | 8819114 | 2017-12-19 14:54:15 -0800 | [diff] [blame] | 30 | |
Dmitrii Filippov | daf0ec9 | 2020-03-17 11:27:28 +0100 | [diff] [blame] | 31 | static get is() { return 'gr-default-editor'; } |
| 32 | /** |
| 33 | * Fired when the content of the editor changes. |
| 34 | * |
| 35 | * @event content-change |
| 36 | */ |
| 37 | |
| 38 | static get properties() { |
| 39 | return { |
| 40 | fileContent: String, |
| 41 | }; |
Dmitrii Filippov | 3fd2b10 | 2019-11-15 16:16:46 +0100 | [diff] [blame] | 42 | } |
| 43 | |
Dmitrii Filippov | daf0ec9 | 2020-03-17 11:27:28 +0100 | [diff] [blame] | 44 | _handleTextareaInput(e) { |
| 45 | this.dispatchEvent(new CustomEvent( |
| 46 | 'content-change', |
| 47 | {detail: {value: e.target.value}, bubbles: true, composed: true})); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | customElements.define(GrDefaultEditor.is, GrDefaultEditor); |