Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
annda committed Nov 8, 2023
1 parent 196b840 commit 2528599
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 5 additions & 3 deletions parser/InternalLinkNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace dokuwiki\plugin\prosemirror\parser;

use dokuwiki\File\PageResolver;

class InternalLinkNode extends LinkNode
{
public function toSyntax()
Expand Down Expand Up @@ -43,10 +45,10 @@ public static function resolveLink($inner, $curId) {
if (count($parts) === 2) {
$params = $parts[1];
}
$ns = getNS($curId);
$xhtml_renderer = p_get_renderer('xhtml');
$default = $xhtml_renderer->_simpleTitle($parts[0]);
resolve_pageid($ns, $resolvedPageId, $exists);
$resolver = new PageResolver($curId);
$resolvedPageId = $resolver->resolveId($resolvedPageId);

if (useHeading('content')) {
$heading = p_get_first_heading($resolvedPageId);
Expand All @@ -59,7 +61,7 @@ public static function resolveLink($inner, $curId) {

return [
'id' => $resolvedPageId,
'exists' => $exists,
'exists' => page_exists($resolvedPageId),
'heading' => $heading,
'url' => $url,
];
Expand Down
8 changes: 7 additions & 1 deletion parser/LinkNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace dokuwiki\plugin\prosemirror\parser;

use dokuwiki\File\MediaResolver;

abstract class LinkNode extends Node implements InlineNodeInterface
{

Expand Down Expand Up @@ -128,7 +130,11 @@ public static function resolveImageTitle($pageId, $imageId, $title = null, $alig
$xhtml_renderer = p_get_renderer('xhtml');
$src = $imageId;
if (!media_isexternal($src)) {
resolve_mediaid(getNS($pageId), $src, $exists);
$resolver = new MediaResolver(getNS($pageId));
$media = $resolver->resolveId($src);
if (!media_exists($media)) {
return '';
}
}
return $xhtml_renderer->_media(
$src,
Expand Down
4 changes: 3 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ function menubar() {
threshold: [0, 1]
}
);
observer.observe(editorswitch);
if (editorswitch && menubar) {
observer.observe(editorswitch);
}
}


Expand Down

0 comments on commit 2528599

Please sign in to comment.