protected function getInstance($selector = '')
    {
        if (empty($this->object)) {
            throw new \RuntimeException('Editor instance was not set.');
        }

        if (empty($this->selector) && empty($selector)) {
            throw new \RuntimeException('No such editor was not selected.');
        }

        $this->setSelector($selector);

        if (empty($this->instances[$this->selector])) {
            $instanceId = $this->context->element('field', $this->selector)->getAttribute('id');
            $instance = sprintf($this->object, $instanceId);

            if (!$this->context->executeJs("return !!$instance")) {
                throw new \Exception(sprintf('Editor "%s" was not found.', $instanceId));
            }

            $this->instances[$this->selector] = $instance;
        }

        return $this->instances[$this->selector];
    }