-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugin Editor experiment "Awesomplete"
- Loading branch information
Showing
10 changed files
with
237 additions
and
45 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"title": "Awesomplete", | ||
"type": "string", | ||
"description": "Awesomplete is an ultra lightweight, customizable, simple autocomplete widget with zero dependencies, built with modern standards for modern browsers.", | ||
"x-options": { | ||
"awesomplete": { | ||
"list": ["JavaScript", "Java", "Python", "Ruby", "C++", "C#", "PHP", "Swift", "Go", "Kotlin"], | ||
"minChars": 1, | ||
"maxItems": 5, | ||
"autoFirst": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import EditorString from './string.js' | ||
import { pathToAttribute } from '../helpers/utils.js' | ||
import {getSchemaDescription, getSchemaOption, getSchemaTitle, getSchemaXOption} from '../helpers/schema.js' | ||
|
||
/** | ||
* Represents a EditorStringAwesomplete instance. | ||
* @extends Editor | ||
*/ | ||
class EditorStringAwesomplete extends EditorString { | ||
build () { | ||
this.control = this.theme.getInputControl({ | ||
type: 'text', | ||
id: pathToAttribute(this.instance.path), | ||
label: getSchemaTitle(this.instance.schema) || this.instance.getKey(), | ||
titleHidden: getSchemaOption(this.instance.schema, 'titleHidden'), | ||
description: getSchemaDescription(this.instance.schema) | ||
}) | ||
|
||
try { | ||
new window.Awesomplete(this.control.input, getSchemaXOption(this.instance.schema, 'awesomplete')) | ||
this.control.container.querySelector('.awesomplete').style.display = 'block' | ||
} catch (e) { | ||
console.error('Awesomplete is not available or not loaded correctly.', e) | ||
} | ||
} | ||
|
||
addEventListeners () { | ||
} | ||
|
||
refreshUI () { | ||
this.refreshInteractiveElements() | ||
|
||
// this.control.radios.forEach((radio) => { | ||
// radio.checked = (radio.value === this.instance.getValue()) | ||
// }) | ||
} | ||
} | ||
|
||
export default EditorStringAwesomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters