update kirby to v5 and add refresh cache panel view button

This commit is contained in:
isUnknown 2025-09-10 14:28:38 +02:00
commit 9a86d41254
466 changed files with 19960 additions and 10497 deletions

View file

@ -8,16 +8,14 @@ use DOMXPath;
use Kirby\Toolkit\Str;
/**
* Represents a block level element
* in an HTML document
*
* @since 3.5.0
* Represents a block level element in an HTML document
*
* @package Kirby Parsley
* @author Bastian Allgeier <bastian@getkirby.com>,
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier
* @license https://getkirby.com/license
* @since 3.5.0
*/
class Element
{

View file

@ -9,16 +9,14 @@ use DOMText;
use Kirby\Toolkit\Html;
/**
* Represents an inline element
* in an HTML document
*
* @since 3.5.0
* Represents an inline element in an HTML document
*
* @package Kirby Parsley
* @author Bastian Allgeier <bastian@getkirby.com>,
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier
* @license https://getkirby.com/license
* @since 3.5.0
*/
class Inline
{

View file

@ -2,7 +2,9 @@
namespace Kirby\Parsley;
use DOMComment;
use DOMDocument;
use DOMDocumentType;
use DOMElement;
use DOMNode;
use DOMText;
@ -13,13 +15,12 @@ use Kirby\Toolkit\Dom;
* HTML parser to extract the best possible blocks
* from any kind of HTML document
*
* @since 3.5.0
*
* @package Kirby Parsley
* @author Bastian Allgeier <bastian@getkirby.com>,
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier
* @license https://getkirby.com/license
* @since 3.5.0
*/
class Parsley
{
@ -123,7 +124,7 @@ class Parsley
*/
public function endInlineBlock(): void
{
if (empty($this->inline) === true) {
if ($this->inline === []) {
return;
}
@ -193,7 +194,7 @@ class Parsley
}
$marks = array_column($this->marks, 'tag');
return in_array($element->tagName, $marks);
return in_array($element->tagName, $marks, true);
}
return false;
@ -212,7 +213,7 @@ class Parsley
) {
$this->blocks[$lastIndex]['content']['text'] .= ' ' . $block['content']['text'];
// append
// append
} else {
$this->blocks[] = $block;
}
@ -224,10 +225,11 @@ class Parsley
*/
public function parseNode(DOMNode $element): bool
{
$skip = ['DOMComment', 'DOMDocumentType'];
// unwanted element types
if (in_array(get_class($element), $skip) === true) {
if (
$element instanceof DOMComment ||
$element instanceof DOMDocumentType
) {
return false;
}
@ -239,12 +241,13 @@ class Parsley
$this->endInlineBlock();
// known block nodes
if ($this->isBlock($element) === true) {
/**
* @var DOMElement $element
*/
if ($parser = ($this->nodes[$element->tagName]['parse'] ?? null)) {
if ($parser = $this->nodes[$element->tagName]['parse'] ?? null) {
if ($result = $parser(new Element($element, $this->marks))) {
$this->blocks[] = $result;
}
@ -257,7 +260,7 @@ class Parsley
/**
* @var DOMElement $element
*/
if (in_array($element->tagName, $this->skip) === true) {
if (in_array($element->tagName, $this->skip, true) === true) {
return false;
}
@ -270,7 +273,7 @@ class Parsley
// wrapper elements should never be converted
// to a simple fallback block. Their children
// have to be parsed individually.
if (in_array($element->tagName, $wrappers) === false) {
if (in_array($element->tagName, $wrappers, true) === false) {
$node = new Element($element, $this->marks);
if ($block = $this->fallback($node)) {

View file

@ -3,15 +3,15 @@
namespace Kirby\Parsley;
/**
* Block schema definition
*
* @since 3.5.0
* Schema definition how to parse
* the HTML document into blocks
*
* @package Kirby Parsley
* @author Bastian Allgeier <bastian@getkirby.com>,
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier
* @license https://getkirby.com/license
* @since 3.5.0
*/
class Schema
{

View file

@ -8,16 +8,15 @@ use Kirby\Parsley\Element;
use Kirby\Toolkit\Str;
/**
* The plain schema definition converts
* the entire document into simple text blocks
*
* @since 3.5.0
* The blocks schema definition converts
* the entire document into blocks for the blocks field
*
* @package Kirby Parsley
* @author Bastian Allgeier <bastian@getkirby.com>,
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier
* @license https://getkirby.com/license
* @since 3.5.0
*/
class Blocks extends Plain
{
@ -187,7 +186,7 @@ class Blocks extends Plain
} elseif ($child instanceof DOMElement) {
$child = new Element($child);
$list = ['ul', 'ol'];
$innerHtml .= match (in_array($child->tagName(), $list)) {
$innerHtml .= match (in_array($child->tagName(), $list, true)) {
true => $this->list($child),
default => $child->innerHTML($this->marks())
};

View file

@ -10,13 +10,12 @@ use Kirby\Toolkit\Str;
* The plain schema definition converts
* the entire document into simple text blocks
*
* @since 3.5.0
*
* @package Kirby Parsley
* @author Bastian Allgeier <bastian@getkirby.com>,
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier
* @license https://getkirby.com/license
* @since 3.5.0
*/
class Plain extends Schema
{