-
Notifications
You must be signed in to change notification settings - Fork 159
Add InputEvent
, StaticRange
, AbstractRange
#695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
408830d
Extract AbstractRange interface
armanbilge b2d6b54
Add StaticRange
armanbilge aba6ff8
Add InputEvent
armanbilge 0aa28ef
Update API reports
armanbilge 0a01fbc
Add missing initializer
armanbilge d8e03ba
AbstractRange should be an abstract class
armanbilge 040c415
Review comments
armanbilge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add InputEvent
- Loading branch information
commit aba6ff84b7a8e5ccb564d48b5817f97984b1252e
There are no files selected for viewing
This file contains hidden or 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,55 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
@js.native | ||
sealed trait InputType extends js.Any | ||
|
||
object InputType { | ||
val insertText: InputType = "insertText".asInstanceOf[InputType] | ||
val insertReplacementText: InputType = "insertReplacementText".asInstanceOf[InputType] | ||
val insertLineBreak: InputType = "insertLineBreak".asInstanceOf[InputType] | ||
val insertParagraph: InputType = "insertParagraph".asInstanceOf[InputType] | ||
val insertOrderedList: InputType = "insertOrderedList".asInstanceOf[InputType] | ||
val insertUnorderedList: InputType = "insertUnorderedList".asInstanceOf[InputType] | ||
val insertHorizontalRule: InputType = "insertHorizontalRule".asInstanceOf[InputType] | ||
val insertFromYank: InputType = "insertFromYank".asInstanceOf[InputType] | ||
val insertFromDrop: InputType = "insertFromDrop".asInstanceOf[InputType] | ||
val insertFromPaste: InputType = "insertFromPaste".asInstanceOf[InputType] | ||
val insertFromPasteAsQuotation: InputType = "insertFromPasteAsQuotation".asInstanceOf[InputType] | ||
val insertTranspose: InputType = "insertTranspose".asInstanceOf[InputType] | ||
val insertCompositionText: InputType = "insertCompositionText".asInstanceOf[InputType] | ||
val insertLink: InputType = "insertLink".asInstanceOf[InputType] | ||
val deleteWordBackward: InputType = "deleteWordBackward".asInstanceOf[InputType] | ||
val deleteWordForward: InputType = "deleteWordForward".asInstanceOf[InputType] | ||
val deleteSoftLineBackward: InputType = "deleteSoftLineBackward".asInstanceOf[InputType] | ||
val deleteSoftLineForward: InputType = "deleteSoftLineForward".asInstanceOf[InputType] | ||
val deleteEntireSoftLine: InputType = "deleteEntireSoftLine".asInstanceOf[InputType] | ||
val deleteHardLineBackward: InputType = "deleteHardLineBackward".asInstanceOf[InputType] | ||
val deleteHardLineForward: InputType = "deleteHardLineForward".asInstanceOf[InputType] | ||
val deleteByDrag: InputType = "deleteByDrag".asInstanceOf[InputType] | ||
val deleteByCut: InputType = "deleteByCut".asInstanceOf[InputType] | ||
val deleteContent: InputType = "deleteContent".asInstanceOf[InputType] | ||
val deleteContentBackward: InputType = "deleteContentBackward".asInstanceOf[InputType] | ||
val deleteContentForward: InputType = "deleteContentForward".asInstanceOf[InputType] | ||
val historyUndo: InputType = "historyUndo".asInstanceOf[InputType] | ||
val historyRedo: InputType = "historyRedo".asInstanceOf[InputType] | ||
val formatBold: InputType = "formatBold".asInstanceOf[InputType] | ||
val formatItalic: InputType = "formatItalic".asInstanceOf[InputType] | ||
val formatUnderline: InputType = "formatUnderline".asInstanceOf[InputType] | ||
val formatStrikeThrough: InputType = "formatStrikeThrough".asInstanceOf[InputType] | ||
val formatSuperscript: InputType = "formatSuperscript".asInstanceOf[InputType] | ||
val formatSubscript: InputType = "formatSubscript".asInstanceOf[InputType] | ||
val formatJustifyFull: InputType = "formatJustifyFull".asInstanceOf[InputType] | ||
val formatJustifyCenter: InputType = "formatJustifyCenter".asInstanceOf[InputType] | ||
val formatJustifyRight: InputType = "formatJustifyRight".asInstanceOf[InputType] | ||
val formatJustifyLeft: InputType = "formatJustifyLeft".asInstanceOf[InputType] | ||
val formatIndent: InputType = "formatIndent".asInstanceOf[InputType] | ||
val formatOutdent: InputType = "formatOutdent".asInstanceOf[InputType] | ||
val formatRemove: InputType = "formatRemove".asInstanceOf[InputType] | ||
val formatSetBlockTextDirection: InputType = "formatSetBlockTextDirection".asInstanceOf[InputType] | ||
val formatSetInlineTextDirection: InputType = "formatSetInlineTextDirection".asInstanceOf[InputType] | ||
val formatBackColor: InputType = "formatBackColor".asInstanceOf[InputType] | ||
val formatFontColor: InputType = "formatFontColor".asInstanceOf[InputType] | ||
val formatFontName: InputType = "formatFontName".asInstanceOf[InputType] | ||
} |
This file contains hidden or 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,54 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
opaque type InputType <: String = String | ||
|
||
object InputType { | ||
val insertText: InputType = "insertText" | ||
val insertReplacementText: InputType = "insertReplacementText" | ||
val insertLineBreak: InputType = "insertLineBreak" | ||
val insertParagraph: InputType = "insertParagraph" | ||
val insertOrderedList: InputType = "insertOrderedList" | ||
val insertUnorderedList: InputType = "insertUnorderedList" | ||
val insertHorizontalRule: InputType = "insertHorizontalRule" | ||
val insertFromYank: InputType = "insertFromYank" | ||
val insertFromDrop: InputType = "insertFromDrop" | ||
val insertFromPaste: InputType = "insertFromPaste" | ||
val insertFromPasteAsQuotation: InputType = "insertFromPasteAsQuotation" | ||
val insertTranspose: InputType = "insertTranspose" | ||
val insertCompositionText: InputType = "insertCompositionText" | ||
val insertLink: InputType = "insertLink" | ||
val deleteWordBackward: InputType = "deleteWordBackward" | ||
val deleteWordForward: InputType = "deleteWordForward" | ||
val deleteSoftLineBackward: InputType = "deleteSoftLineBackward" | ||
val deleteSoftLineForward: InputType = "deleteSoftLineForward" | ||
val deleteEntireSoftLine: InputType = "deleteEntireSoftLine" | ||
val deleteHardLineBackward: InputType = "deleteHardLineBackward" | ||
val deleteHardLineForward: InputType = "deleteHardLineForward" | ||
val deleteByDrag: InputType = "deleteByDrag" | ||
val deleteByCut: InputType = "deleteByCut" | ||
val deleteContent: InputType = "deleteContent" | ||
val deleteContentBackward: InputType = "deleteContentBackward" | ||
val deleteContentForward: InputType = "deleteContentForward" | ||
val historyUndo: InputType = "historyUndo" | ||
val historyRedo: InputType = "historyRedo" | ||
val formatBold: InputType = "formatBold" | ||
val formatItalic: InputType = "formatItalic" | ||
val formatUnderline: InputType = "formatUnderline" | ||
val formatStrikeThrough: InputType = "formatStrikeThrough" | ||
val formatSuperscript: InputType = "formatSuperscript" | ||
val formatSubscript: InputType = "formatSubscript" | ||
val formatJustifyFull: InputType = "formatJustifyFull" | ||
val formatJustifyCenter: InputType = "formatJustifyCenter" | ||
val formatJustifyRight: InputType = "formatJustifyRight" | ||
val formatJustifyLeft: InputType = "formatJustifyLeft" | ||
val formatIndent: InputType = "formatIndent" | ||
val formatOutdent: InputType = "formatOutdent" | ||
val formatRemove: InputType = "formatRemove" | ||
val formatSetBlockTextDirection: InputType = "formatSetBlockTextDirection" | ||
val formatSetInlineTextDirection: InputType = "formatSetInlineTextDirection" | ||
val formatBackColor: InputType = "formatBackColor" | ||
val formatFontColor: InputType = "formatFontColor" | ||
val formatFontName: InputType = "formatFontName" | ||
} |
This file contains hidden or 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,41 @@ | ||
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API | ||
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later. | ||
* http://creativecommons.org/licenses/by-sa/2.5/ | ||
* | ||
* Everything else is under the MIT License http://opensource.org/licenses/MIT | ||
*/ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation._ | ||
|
||
/** The InputEvent interface represents an event notifying the user of editable content changes. */ | ||
@js.native | ||
@JSGlobal | ||
class InputEvent(typeArg: String, init: InputEventInit) extends UIEvent(typeArg, init) { | ||
|
||
def this(typeArg: String) = this(typeArg, js.native) | ||
|
||
/** Returns a DOMString with the inserted characters. This may be an empty string if the change doesn't insert text | ||
* (such as when deleting characters, for example). | ||
*/ | ||
def data: String = js.native | ||
|
||
/** Returns a DataTransfer object containing information about richtext or plaintext data being added to or removed | ||
* from editable content. | ||
*/ | ||
def dataTransfer: DataTransfer = js.native | ||
|
||
/** Returns the type of change for editable content such as, for example, inserting, deleting, or formatting text. See | ||
* the property page for a complete list of input types. | ||
*/ | ||
def inputType: InputType = js.native | ||
|
||
/** Returns a Boolean value indicating if the event is fired after compositionstart and before compositionend. */ | ||
def isComposing: Boolean = js.native | ||
|
||
/** Returns an array of static ranges that will be affected by a change to the DOM if the input event is not canceled. | ||
*/ | ||
def getTargetRanges(): js.Array[StaticRange] = js.native | ||
|
||
} |
This file contains hidden or 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,17 @@ | ||
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API | ||
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later. | ||
* http://creativecommons.org/licenses/by-sa/2.5/ | ||
* | ||
* Everything else is under the MIT License http://opensource.org/licenses/MIT | ||
*/ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
trait InputEventInit extends UIEventInit { | ||
var inputType: js.UndefOr[InputType] = js.undefined | ||
var data: js.UndefOr[String] = js.undefined | ||
var dataTransfer: js.UndefOr[DataTransfer] = js.undefined | ||
var isComposing: js.UndefOr[Boolean] = js.undefined | ||
var ranges: js.UndefOr[js.Array[StaticRange]] | ||
armanbilge marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.