Skip to content
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

"Show changes" doesn't show edit window and buttons below the changes #319

Open
stefahn opened this issue Mar 15, 2022 · 25 comments
Open

"Show changes" doesn't show edit window and buttons below the changes #319

stefahn opened this issue Mar 15, 2022 · 25 comments
Labels

Comments

@stefahn
Copy link
Contributor

stefahn commented Mar 15, 2022

For editing pages I use action=formedit and the extensions PageForms, VirtualEditor and VEForAll. After clicking "Show changes" the changes are shown. But below there is no edit window and there are no buttons.

When I switch to the Vector skin the edit window and the buttons show up as expected. So I figured it might be a Chameleon issue.

Using MediaWiki 1.35.5, Chameleon 4.0.0, the latest master versions of PageForms and VEForAll, and the latest version of VirtualEditor 1_35 branch.

@WouterRademaker
Copy link
Contributor

The same with MediaWiki 1.37.1, Chameleon 4.0.0 and Page Forms 5.3.4

@malberts
Copy link
Contributor

I reproduced this on a clean wiki with:

  • MW 1.37.1
  • Chameleon (master)
  • Page Forms (master)

It happens even without VisualEditor and VEForAll.

Screenshot_20220326_134617

Do either of you know with which versions this still worked?

@malberts malberts added the bug label Mar 26, 2022
@malberts
Copy link
Contributor

Looks like this has not worked for a long time. I went as far back as the following:
Mediawiki 1.35.5
Chameleon 3.1.0 (24 Sep 2020)
PageForms 5.0.1 (22 Dec 2020)

@stefahn
Copy link
Contributor Author

stefahn commented Apr 8, 2022

Do either of you know with which versions this still worked?

I think with MediaWiki 1.34 and Chameleon 3 it still worked.

@stefahn
Copy link
Contributor Author

stefahn commented Nov 2, 2022

Hm, this bug causes trouble in our team since edited text sometimes gets lost when one clicks on "Show changes".

Any update on this? Thanks a lot!

@stefahn
Copy link
Contributor Author

stefahn commented Jan 6, 2023

The problem also occurs when I click on "Show preview".

Do you think it's a Chameleon issue or a PageForms issue?

@ckapop
Copy link

ckapop commented Oct 4, 2023

Any news on this?

@ckapop
Copy link

ckapop commented Oct 8, 2023

I think I might have found the issue that was causing this error. Since the code change it seems to be working as expected.

I am using Chameleon 4.1.0
Within the protected function buildContentBody() in MainContent.php make the following change:

// Comment out this line.
// $this->indent() . $this->getSkinTemplate()->get( 'bodytext' ) .
// Replace with this line.
$this->indent() . $this->getSkin()->getOutput()->mBodytext .

If you are using a newer version and still have the same issue it looks like things have changed a bit with MainContent.php.
Within the protected function buildContentBody() in ContentBody.php maybe make the same change as above.

I will keep testing but so far it seems to be working for me.

@WouterRademaker
Copy link
Contributor

WouterRademaker commented Oct 11, 2023

Ckapop's fix fixes the problem on Chameleon 4.2.1 too, but it introduces another problem. The fix breaks the Maps extension, maps remain greyed out, busy loading.

  • Maps 10.0.0

@ckapop
Copy link

ckapop commented Oct 11, 2023

It also breaks editing with Visual Editor, same busy loading type issue. Still investigating this.

@ckapop
Copy link

ckapop commented Oct 13, 2023

@WouterRademaker, I think I have another workaround if you would like to try it out. It seems the template created by the Page Form previews isn't making it's way down to the Chameleon components. Remove any of the previous changes and start from scratch before making these edits. Let me know if you see any weird behavior. Maps and the VE are rendering for me with this work around.

  1. src/ChameleonTemplate.php
	public function execute() {
		// output the head element
		// The headelement defines the <body> tag itself, it shouldn't be included in the html text
		// To add attributes or classes to the body tag use OutputPageBodyAttributes hook
		$this->html( 'headelement' );
		echo $this->getSkin()->getComponentFactory()->getRootComponent()->getHtml($this); // Added $this
		$this->printTrail();
		echo "</body>\n</html>";
	}
  1. src/Components/Structure.php
	public function getHtml($tpl = null) { // Added $tpl = null
		$ret = '';

		foreach ( $this->getSubcomponents() as $component ) {
			$ret .= $component->getHtml($tpl); // Added $tpl
		}

		return $ret;
	}
  1. src/Components/Container.php
	public function getHtml($tpl = null) { // Added $tpl = null
		$attribs = [ 'class' => $this->getClassString() ];

		$id = $this->getAttribute( 'id' );
		if ( $id !== '' ) {
			$attribs['id'] = IdRegistry::getRegistry()->getId( $id );
		}

		$ret = $this->indent() . \Html::openElement( 'div', $attribs );
		$this->indent( 1 );

		$ret .= parent::getHtml($tpl); // Added $tpl

		$ret .= $this->indent( -1 ) . '</div>';

		return $ret;
	}
  1. src/Components/MainContent.php
	public function getHtml($tpl = null) { // Added $tpl = null
                // Added if block to set template
		if ( !is_null( $tpl ) ) {
                	$this->setSkinTemplate($tpl);
                }
		$idRegistry = IdRegistry::getRegistry();

		$topAnchor = $idRegistry->element( 'a', [ 'id' => 'top' ] );
		$mwIndicators = $idRegistry->element( 'div', [ 'id' => 'mw-indicators',
			'class' => 'mw-indicators', ], $this->buildMwIndicators() );

		$mwBody =
			$topAnchor .
			$this->indent( 1 ) . $mwIndicators .

			$this->buildContentHeader() .
			$this->buildContentBody() .
			$this->buildCategoryLinks() .
			$this->indent( -1 );

		return $this->indent() . '<!-- start the content area -->' .
			$this->indent() . $idRegistry->element(
				'div',
				[ 'id' => 'content', 'class' => 'mw-body ' . $this->getClassString() ],
				$mwBody
			);
	}
  1. src/Components/Component.php
    // Add this function
    public function setSkinTemplate($tpl) {
        $this->mSkinTemplate = $tpl;
    }

@WouterRademaker
Copy link
Contributor

@ckapop I have tried out the changes, but the only thing I get is a blank page with an empty body. Are these 4 changes the only ones you made?

@ckapop
Copy link

ckapop commented Oct 13, 2023

@WouterRademaker Sorry, I did forget something. I added 5 above.

@WouterRademaker
Copy link
Contributor

@ckapop, Still a blank page with an empty body.

@ckapop
Copy link

ckapop commented Oct 14, 2023

@WouterRademaker I get the blank screen with the empty body if I omit step 5. It is working for me with step 5. I recently added $tpl parameter to all the other classes extending Component. just to be safe and it's working. I put the changes here: https://github.com/ckapop/chameleon/tree/pageform-preview-test

@WouterRademaker
Copy link
Contributor

WouterRademaker commented Oct 14, 2023

@ckapop you used version 4.1.0 as basis, but I tried the changes on version 4.2.1, that didn't work.

I'm now testing your version 4.1.0.

@ckapop
Copy link

ckapop commented Oct 20, 2023

@WouterRademaker How did your 4.1.0 test go?

@WouterRademaker
Copy link
Contributor

WouterRademaker commented Oct 20, 2023

How did your 4.1.0 test go?

I have added this to "chameleon.css" to separate the preview from the edit form and box. This to avoid getting the edit form next to a long info box.
#pfForm { clear: both; border-top: 1px solid rgba(0,0,0,0.1); }
Other than that, I don't see any problems.

@WouterRademaker
Copy link
Contributor

WouterRademaker commented Oct 31, 2023

@ckapop It might be useful to see what changes are needed on 4.2.1 4.3.0 / Master to solve this problem. So that the changes can be included in the next release.

@ckapop
Copy link

ckapop commented Nov 8, 2023

Agree. I will investigate this next week when we upgrade to the latest version.

@WouterRademaker
Copy link
Contributor

WouterRademaker commented Nov 27, 2023

I have tried to do the changes on 4.3.0: https://github.com/WouterRademaker/chameleon
It seems to work, @ckapop please test.

@ckapop
Copy link

ckapop commented Dec 14, 2023

@WouterRademaker there seems to be an issue causing createIncompleteSetupTaskNotification to get displayed twice. I am looking into it.

@WouterRademaker
Copy link
Contributor

WouterRademaker commented Dec 14, 2023

@ckapop and the PHPUnit tests needs updating.

@ckapop
Copy link

ckapop commented Dec 14, 2023

@WouterRademaker So the createIncompleteSetupTaskNotification duplication display is also happening in the default Vector skin so I think this is a PageForms issue.

@WouterRademaker
Copy link
Contributor

The bug still with MediaWiki 1.39.8, Chameleon 4.4.0 and Page Forms 5.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants