diff --git a/packages/slate/src/interfaces/element.js b/packages/slate/src/interfaces/element.js
index 7ccff5e8f..0bccea955 100644
--- a/packages/slate/src/interfaces/element.js
+++ b/packages/slate/src/interfaces/element.js
@@ -973,7 +973,7 @@ class ElementInterface {
const [previousText, previousPath] = previous
if (closestBlock.hasDescendant(previousPath)) {
- return previous.getMarksAtIndex(previousText.text.length)
+ return previousText.getMarksAtIndex(previousText.text.length)
}
return currentMarks
diff --git a/packages/slate/test/models/node/get-marks-at-position/marked-text-with-zero-offset-with-no-previous-text.js b/packages/slate/test/models/node/get-marks-at-position/marked-text-with-zero-offset-with-no-previous-text.js
new file mode 100644
index 000000000..f60ce87d6
--- /dev/null
+++ b/packages/slate/test/models/node/get-marks-at-position/marked-text-with-zero-offset-with-no-previous-text.js
@@ -0,0 +1,25 @@
+/** @jsx h */
+
+import h from '../../../helpers/h'
+import { Set } from 'immutable'
+import PathUtils from '../../../../src/utils/path-utils'
+
+const path = PathUtils.create([0, 0])
+
+export const input = (
+
+
+
+
+ Cat is Cute
+
+
+
+
+)
+
+export default function({ document, selection }) {
+ return document.getMarksAtPosition(path, 0)
+}
+
+export const output = Set.of()
diff --git a/packages/slate/test/models/node/get-marks-at-position/marked-text-with-zero-offset-with-previous-text-not-in-the-same-block.js b/packages/slate/test/models/node/get-marks-at-position/marked-text-with-zero-offset-with-previous-text-not-in-the-same-block.js
new file mode 100644
index 000000000..3ecbc54ff
--- /dev/null
+++ b/packages/slate/test/models/node/get-marks-at-position/marked-text-with-zero-offset-with-previous-text-not-in-the-same-block.js
@@ -0,0 +1,29 @@
+/** @jsx h */
+
+import h from '../../../helpers/h'
+import { Set } from 'immutable'
+import { Mark } from 'slate'
+import PathUtils from '../../../../src/utils/path-utils'
+
+const path = PathUtils.create([1, 0])
+
+export const input = (
+
+
+
+ Cat is Cute
+
+
+
+ Dog is Delightful
+
+
+
+
+)
+
+export default function({ document, selection }) {
+ return document.getMarksAtPosition(path, 0)
+}
+
+export const output = Set.of(Mark.create('bold'))
diff --git a/packages/slate/test/models/node/get-marks-at-position/marked-text.js b/packages/slate/test/models/node/get-marks-at-position/marked-text.js
new file mode 100644
index 000000000..ed8730c8c
--- /dev/null
+++ b/packages/slate/test/models/node/get-marks-at-position/marked-text.js
@@ -0,0 +1,28 @@
+/** @jsx h */
+
+import h from '../../../helpers/h'
+import { Set } from 'immutable'
+import { Mark } from 'slate'
+import PathUtils from '../../../../src/utils/path-utils'
+
+const path = PathUtils.create([0, 0])
+
+export const input = (
+
+
+
+
+ Cat
+ is
+ Cute
+
+
+
+
+)
+
+export default function({ document, selection }) {
+ return document.getMarksAtPosition(path, 1)
+}
+
+export const output = Set.of(Mark.create('italic'))
diff --git a/packages/slate/test/models/node/get-marks-at-position/text-with-zero-offset.js b/packages/slate/test/models/node/get-marks-at-position/text-with-zero-offset.js
new file mode 100644
index 000000000..186704122
--- /dev/null
+++ b/packages/slate/test/models/node/get-marks-at-position/text-with-zero-offset.js
@@ -0,0 +1,32 @@
+/** @jsx h */
+
+import h from '../../../helpers/h'
+import { Set } from 'immutable'
+import { Mark } from 'slate'
+import PathUtils from '../../../../src/utils/path-utils'
+
+const path = PathUtils.create([1, 1, 0])
+
+export const input = (
+
+
+
+ Cat is Cute
+
+
+
+ Dog is
+
+
+ Delightful
+
+
+
+
+)
+
+export default function({ document, selection }) {
+ return document.getMarksAtPosition(path, 0)
+}
+
+export const output = Set.of(Mark.create('bold'))
diff --git a/packages/slate/test/models/node/get-marks-at-position/unmarked-text.js b/packages/slate/test/models/node/get-marks-at-position/unmarked-text.js
new file mode 100644
index 000000000..1bc1e448f
--- /dev/null
+++ b/packages/slate/test/models/node/get-marks-at-position/unmarked-text.js
@@ -0,0 +1,23 @@
+/** @jsx h */
+
+import h from '../../../helpers/h'
+import { Set } from 'immutable'
+import PathUtils from '../../../../src/utils/path-utils'
+
+const path = PathUtils.create([0, 0])
+
+export const input = (
+
+
+
+ Cat is Cute
+
+
+
+)
+
+export default function({ document, selection }) {
+ return document.getMarksAtPosition(path, 1)
+}
+
+export const output = Set.of()