Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Scoped themes to apply only to the editor (#editor-holder) #8447

Merged
merged 4 commits into from
Jul 18, 2014
Merged

Scoped themes to apply only to the editor (#editor-holder) #8447

merged 4 commits into from
Jul 18, 2014

Conversation

MiguelCastillo
Copy link
Contributor

@@ -156,7 +156,7 @@ define(function (require, exports, module) {
filename: fixPath(theme.file._path)
});

parser.parse("." + theme.className + "{" + content + "}", function (err, tree) {
parser.parse("." + theme.className + " #editor-holder {" + content + "}", function (err, tree) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clear up my own confusion... :-) Why is the theme.className prefix needed? I think in another thread you mentioned you're deleting the <style> tag when a theme is turned off... so is there any need to have a class placed on the root of the DOM if that class will always be present when the theme's rules are in memory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual, you are right. We don't need that. Cleaning it up...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To answer the question though. There is no need for the root class because I remove the style nodes from the DOM. Cant get anything passed you, love it :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, sorry! Maybe I should try out as a soccer goalie ;-)

@MiguelCastillo
Copy link
Contributor Author

It was a bit more involved than I thought to prevent flickering and properly handle unloading the style nodes...

cc @dangoor

@dangoor dangoor self-assigned this Jul 18, 2014
@dangoor
Copy link
Contributor

dangoor commented Jul 18, 2014

Starting review...

The tests are broken.


return $.when.apply(undefined, pendingThemes);
return $.when(pending);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending is just a single promise now, right? So, you can just return it directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes. I commited those changes last night but didn't push. Will do that in a minute

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no what's there is good. There is a the check if the theme is not falsy before it reads the text. The $.when is just a shortcut to always return a promise

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see... it's not necessarily a promise if the current theme is null or undefined.

@dangoor
Copy link
Contributor

dangoor commented Jul 18, 2014

Oh yes, there are some jsdoc changes that are needed as well because of the switch from "current themes" to "current theme".

Review done. I'll look into making the needed changes or filing followups so that I can work based on this code.

  • metadata fixup
  • options.theme.dark
  • test fixing
  • ensure that themeChange is only emitted for real changes
  • jsdoc cleanup

* @return {Array.<Theme>} collection of all available themes
*/
function getAllThemes() {
return _.map(loadedThemes, function (item) {
return item;
return loadedThemes.map(function (theme) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh, this doesn't work because loadedThemes is an object and doesn't have map. _.map will take an object and iterate on its values.

@dangoor
Copy link
Contributor

dangoor commented Jul 18, 2014

I noticed something in the tests that I hadn't before: the async tests are missing the it() wrapper. async testing in Jasmine 1.x is weird and annoying.

In the process of reformatting those tests a bit to fit how Jasmine works, I noticed that loadDirectory seems actually broken. I'd like to just remove that function, since we don't need it in core and the primary way that core anticipates themes being installed is via extensions. If an extension wants to implement its own loadDirectory, that would be fine. What do you think?

@dangoor
Copy link
Contributor

dangoor commented Jul 18, 2014

I've split off the themeChange event thing into #8457.

@MiguelCastillo
Copy link
Contributor Author

Hey Kevin... Let me go over what you have reviewed... I was winging it from a docs appointment, but i need to go through it again.

So, it's very apparent I missed several small little issues. Sorry man, I guess I was more tired than I thought :)

@dangoor
Copy link
Contributor

dangoor commented Jul 18, 2014

No problem! It was just minor stuff. I've done the fixups locally already.

@dangoor
Copy link
Contributor

dangoor commented Jul 18, 2014

Will be merging and pushing this momentarily.

@dangoor dangoor merged commit 219c2ca into adobe:master Jul 18, 2014
@MiguelCastillo
Copy link
Contributor Author

Sweet! Thanks dude!

@MiguelCastillo MiguelCastillo deleted the themes-8420 branch July 18, 2014 14:26
@MiguelCastillo
Copy link
Contributor Author

So, yeah I did end up removing all the handling for multiple themes. It seemed to have caused more confusion than anything else... Also, removing the loadDirectory stuff is fine. I will probably just make a gist somewhere and reference it in BoilerPlate.

@dangoor
Copy link
Contributor

dangoor commented Jul 18, 2014

OK, I've removed loadDirectory

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

Successfully merging this pull request may close these issues.

3 participants