Skip to content

Commit aba6ff8

Browse files
committed
Add InputEvent
1 parent b2d6b54 commit aba6ff8

File tree

4 files changed

+167
-0
lines changed

4 files changed

+167
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package org.scalajs.dom
2+
3+
import scala.scalajs.js
4+
5+
@js.native
6+
sealed trait InputType extends js.Any
7+
8+
object InputType {
9+
val insertText: InputType = "insertText".asInstanceOf[InputType]
10+
val insertReplacementText: InputType = "insertReplacementText".asInstanceOf[InputType]
11+
val insertLineBreak: InputType = "insertLineBreak".asInstanceOf[InputType]
12+
val insertParagraph: InputType = "insertParagraph".asInstanceOf[InputType]
13+
val insertOrderedList: InputType = "insertOrderedList".asInstanceOf[InputType]
14+
val insertUnorderedList: InputType = "insertUnorderedList".asInstanceOf[InputType]
15+
val insertHorizontalRule: InputType = "insertHorizontalRule".asInstanceOf[InputType]
16+
val insertFromYank: InputType = "insertFromYank".asInstanceOf[InputType]
17+
val insertFromDrop: InputType = "insertFromDrop".asInstanceOf[InputType]
18+
val insertFromPaste: InputType = "insertFromPaste".asInstanceOf[InputType]
19+
val insertFromPasteAsQuotation: InputType = "insertFromPasteAsQuotation".asInstanceOf[InputType]
20+
val insertTranspose: InputType = "insertTranspose".asInstanceOf[InputType]
21+
val insertCompositionText: InputType = "insertCompositionText".asInstanceOf[InputType]
22+
val insertLink: InputType = "insertLink".asInstanceOf[InputType]
23+
val deleteWordBackward: InputType = "deleteWordBackward".asInstanceOf[InputType]
24+
val deleteWordForward: InputType = "deleteWordForward".asInstanceOf[InputType]
25+
val deleteSoftLineBackward: InputType = "deleteSoftLineBackward".asInstanceOf[InputType]
26+
val deleteSoftLineForward: InputType = "deleteSoftLineForward".asInstanceOf[InputType]
27+
val deleteEntireSoftLine: InputType = "deleteEntireSoftLine".asInstanceOf[InputType]
28+
val deleteHardLineBackward: InputType = "deleteHardLineBackward".asInstanceOf[InputType]
29+
val deleteHardLineForward: InputType = "deleteHardLineForward".asInstanceOf[InputType]
30+
val deleteByDrag: InputType = "deleteByDrag".asInstanceOf[InputType]
31+
val deleteByCut: InputType = "deleteByCut".asInstanceOf[InputType]
32+
val deleteContent: InputType = "deleteContent".asInstanceOf[InputType]
33+
val deleteContentBackward: InputType = "deleteContentBackward".asInstanceOf[InputType]
34+
val deleteContentForward: InputType = "deleteContentForward".asInstanceOf[InputType]
35+
val historyUndo: InputType = "historyUndo".asInstanceOf[InputType]
36+
val historyRedo: InputType = "historyRedo".asInstanceOf[InputType]
37+
val formatBold: InputType = "formatBold".asInstanceOf[InputType]
38+
val formatItalic: InputType = "formatItalic".asInstanceOf[InputType]
39+
val formatUnderline: InputType = "formatUnderline".asInstanceOf[InputType]
40+
val formatStrikeThrough: InputType = "formatStrikeThrough".asInstanceOf[InputType]
41+
val formatSuperscript: InputType = "formatSuperscript".asInstanceOf[InputType]
42+
val formatSubscript: InputType = "formatSubscript".asInstanceOf[InputType]
43+
val formatJustifyFull: InputType = "formatJustifyFull".asInstanceOf[InputType]
44+
val formatJustifyCenter: InputType = "formatJustifyCenter".asInstanceOf[InputType]
45+
val formatJustifyRight: InputType = "formatJustifyRight".asInstanceOf[InputType]
46+
val formatJustifyLeft: InputType = "formatJustifyLeft".asInstanceOf[InputType]
47+
val formatIndent: InputType = "formatIndent".asInstanceOf[InputType]
48+
val formatOutdent: InputType = "formatOutdent".asInstanceOf[InputType]
49+
val formatRemove: InputType = "formatRemove".asInstanceOf[InputType]
50+
val formatSetBlockTextDirection: InputType = "formatSetBlockTextDirection".asInstanceOf[InputType]
51+
val formatSetInlineTextDirection: InputType = "formatSetInlineTextDirection".asInstanceOf[InputType]
52+
val formatBackColor: InputType = "formatBackColor".asInstanceOf[InputType]
53+
val formatFontColor: InputType = "formatFontColor".asInstanceOf[InputType]
54+
val formatFontName: InputType = "formatFontName".asInstanceOf[InputType]
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package org.scalajs.dom
2+
3+
import scala.scalajs.js
4+
5+
opaque type InputType <: String = String
6+
7+
object InputType {
8+
val insertText: InputType = "insertText"
9+
val insertReplacementText: InputType = "insertReplacementText"
10+
val insertLineBreak: InputType = "insertLineBreak"
11+
val insertParagraph: InputType = "insertParagraph"
12+
val insertOrderedList: InputType = "insertOrderedList"
13+
val insertUnorderedList: InputType = "insertUnorderedList"
14+
val insertHorizontalRule: InputType = "insertHorizontalRule"
15+
val insertFromYank: InputType = "insertFromYank"
16+
val insertFromDrop: InputType = "insertFromDrop"
17+
val insertFromPaste: InputType = "insertFromPaste"
18+
val insertFromPasteAsQuotation: InputType = "insertFromPasteAsQuotation"
19+
val insertTranspose: InputType = "insertTranspose"
20+
val insertCompositionText: InputType = "insertCompositionText"
21+
val insertLink: InputType = "insertLink"
22+
val deleteWordBackward: InputType = "deleteWordBackward"
23+
val deleteWordForward: InputType = "deleteWordForward"
24+
val deleteSoftLineBackward: InputType = "deleteSoftLineBackward"
25+
val deleteSoftLineForward: InputType = "deleteSoftLineForward"
26+
val deleteEntireSoftLine: InputType = "deleteEntireSoftLine"
27+
val deleteHardLineBackward: InputType = "deleteHardLineBackward"
28+
val deleteHardLineForward: InputType = "deleteHardLineForward"
29+
val deleteByDrag: InputType = "deleteByDrag"
30+
val deleteByCut: InputType = "deleteByCut"
31+
val deleteContent: InputType = "deleteContent"
32+
val deleteContentBackward: InputType = "deleteContentBackward"
33+
val deleteContentForward: InputType = "deleteContentForward"
34+
val historyUndo: InputType = "historyUndo"
35+
val historyRedo: InputType = "historyRedo"
36+
val formatBold: InputType = "formatBold"
37+
val formatItalic: InputType = "formatItalic"
38+
val formatUnderline: InputType = "formatUnderline"
39+
val formatStrikeThrough: InputType = "formatStrikeThrough"
40+
val formatSuperscript: InputType = "formatSuperscript"
41+
val formatSubscript: InputType = "formatSubscript"
42+
val formatJustifyFull: InputType = "formatJustifyFull"
43+
val formatJustifyCenter: InputType = "formatJustifyCenter"
44+
val formatJustifyRight: InputType = "formatJustifyRight"
45+
val formatJustifyLeft: InputType = "formatJustifyLeft"
46+
val formatIndent: InputType = "formatIndent"
47+
val formatOutdent: InputType = "formatOutdent"
48+
val formatRemove: InputType = "formatRemove"
49+
val formatSetBlockTextDirection: InputType = "formatSetBlockTextDirection"
50+
val formatSetInlineTextDirection: InputType = "formatSetInlineTextDirection"
51+
val formatBackColor: InputType = "formatBackColor"
52+
val formatFontColor: InputType = "formatFontColor"
53+
val formatFontName: InputType = "formatFontName"
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API
2+
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later.
3+
* http://creativecommons.org/licenses/by-sa/2.5/
4+
*
5+
* Everything else is under the MIT License http://opensource.org/licenses/MIT
6+
*/
7+
package org.scalajs.dom
8+
9+
import scala.scalajs.js
10+
import scala.scalajs.js.annotation._
11+
12+
/** The InputEvent interface represents an event notifying the user of editable content changes. */
13+
@js.native
14+
@JSGlobal
15+
class InputEvent(typeArg: String, init: InputEventInit) extends UIEvent(typeArg, init) {
16+
17+
def this(typeArg: String) = this(typeArg, js.native)
18+
19+
/** Returns a DOMString with the inserted characters. This may be an empty string if the change doesn't insert text
20+
* (such as when deleting characters, for example).
21+
*/
22+
def data: String = js.native
23+
24+
/** Returns a DataTransfer object containing information about richtext or plaintext data being added to or removed
25+
* from editable content.
26+
*/
27+
def dataTransfer: DataTransfer = js.native
28+
29+
/** Returns the type of change for editable content such as, for example, inserting, deleting, or formatting text. See
30+
* the property page for a complete list of input types.
31+
*/
32+
def inputType: InputType = js.native
33+
34+
/** Returns a Boolean value indicating if the event is fired after compositionstart and before compositionend. */
35+
def isComposing: Boolean = js.native
36+
37+
/** Returns an array of static ranges that will be affected by a change to the DOM if the input event is not canceled.
38+
*/
39+
def getTargetRanges(): js.Array[StaticRange] = js.native
40+
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API
2+
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later.
3+
* http://creativecommons.org/licenses/by-sa/2.5/
4+
*
5+
* Everything else is under the MIT License http://opensource.org/licenses/MIT
6+
*/
7+
package org.scalajs.dom
8+
9+
import scala.scalajs.js
10+
11+
trait InputEventInit extends UIEventInit {
12+
var inputType: js.UndefOr[InputType] = js.undefined
13+
var data: js.UndefOr[String] = js.undefined
14+
var dataTransfer: js.UndefOr[DataTransfer] = js.undefined
15+
var isComposing: js.UndefOr[Boolean] = js.undefined
16+
var ranges: js.UndefOr[js.Array[StaticRange]]
17+
}

0 commit comments

Comments
 (0)